File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,3 +116,4 @@ pypirc
116116* State.json
117117tests /parse_level_two.py
118118certs /
119+ td /td_state.json
Original file line number Diff line number Diff line change @@ -438,25 +438,25 @@ def _token_seconds(self, token_type: str = 'access_token') -> int:
438438 if token_type == 'access_token' :
439439
440440 # if the time to expiration is less than or equal to 0, return 0.
441- if not self .state ['access_token' ] or time .time () >= self .state ['access_token_expires_at' ]:
441+ if not self .state ['access_token' ] or time .time () + 60 >= self .state ['access_token_expires_at' ]:
442442 return 0
443443
444444 # else return the number of seconds until expiration.
445- token_exp = int (self .state ['access_token_expires_at' ] - time .time ())
445+ token_exp = int (self .state ['access_token_expires_at' ] - time .time () - 60 )
446446
447447 # if needed check the refresh token.
448448 elif token_type == 'refresh_token' :
449449
450450 # if the time to expiration is less than or equal to 0, return 0.
451- if not self .state ['refresh_token' ] or time .time () >= self .state ['refresh_token_expires_at' ]:
451+ if not self .state ['refresh_token' ] or time .time () + 60 >= self .state ['refresh_token_expires_at' ]:
452452 return 0
453453
454454 # else return the number of seconds until expiration.
455- token_exp = int (self .state ['refresh_token_expires_at' ] - time .time ())
455+ token_exp = int (self .state ['refresh_token_expires_at' ] - time .time () - 60 )
456456
457457 return token_exp
458458
459- def _token_validation (self , nseconds : int = 5 ):
459+ def _token_validation (self , nseconds : int = 60 ):
460460 """Checks if a token is valid.
461461
462462 Verify the current access token is valid for at least N seconds, and
You can’t perform that action at this time.
0 commit comments