File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -206,18 +206,20 @@ def wrapper(self, *args):
206
206
# Refresh auth token if it expired or will expire very soon
207
207
delta = self ._auth_session ["expire" ] - datetime .now (timezone .utc )
208
208
if delta .total_seconds () < 5 :
209
- if self ._login_type == LoginType .PASSWORD :
209
+ self .log .info ("Token has expired - refreshing..." )
210
+ if self ._auth_params .get ("login" , None ) and self ._auth_params .get ("password" , None ):
210
211
self .log .info ("Token has expired - refreshing..." )
211
212
self .login (self ._auth_params ["login" ], self ._auth_params ["password" ])
212
- elif self . _login_type == LoginType . SSO :
213
+ else :
213
214
raise AuthTokenExpiredError ("Token has expired - please re-login" )
214
215
else :
215
216
# Create a new authorization token
216
- if self ._login_type == LoginType . PASSWORD :
217
- self .log . info ( f"No token - login user: { self ._auth_params [ 'login' ] } " )
217
+ self .log . info ( f"No token - login user: { self . _auth_params [ 'login' ] } " )
218
+ if self ._auth_params . get ( " login" , None ) and self ._auth_params . get ( "password" , None ):
218
219
self .login (self ._auth_params ["login" ], self ._auth_params ["password" ])
219
- elif self ._login_type == LoginType .SSO :
220
- raise AuthTokenExpiredError ("Token has expired - please re-login" )
220
+ else :
221
+ raise ClientError ("Missing login or password" )
222
+
221
223
return f (self , * args )
222
224
223
225
return wrapper
You can’t perform that action at this time.
0 commit comments