File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -31,22 +31,22 @@ def url_to_str(cls, v: typing.Any) -> str:
31
31
32
32
@pydantic .field_validator ("token" )
33
33
def check_token (cls , v : typing .Any ) -> str :
34
- if not (expiry := get_expiry (v )):
34
+ value = v .get_secret_value ()
35
+ if not (expiry := get_expiry (value )):
35
36
raise AssertionError ("Failed to parse Simvue token - invalid token form" )
36
37
if time .time () - expiry > 0 :
37
38
raise AssertionError ("Simvue token has expired" )
38
- return v
39
+ return value
39
40
40
41
@pydantic .model_validator (mode = "after" )
41
- def check_valid_server (cls , values : dict ) -> bool :
42
- url = values ["url" ]
43
- token = values ["token" ]
42
+ @classmethod
43
+ def check_valid_server (cls , values : "ServerSpecifications" ) -> bool :
44
44
headers : dict [str , str ] = {
45
- "Authorization" : f"Bearer { token } " ,
45
+ "Authorization" : f"Bearer { values . token } " ,
46
46
"User-Agent" : f"Simvue Python client { __version__ } " ,
47
47
}
48
48
try :
49
- response = get (f"{ url } /api/version" , headers )
49
+ response = get (f"{ values . url } /api/version" , headers )
50
50
51
51
if response .status_code != http .HTTPStatus .OK or not response .json ().get (
52
52
"version"
You can’t perform that action at this time.
0 commit comments