Skip to content

Commit

Permalink
Merge pull request #84 from nansencenter/hotfix_totp_retry
Browse files Browse the repository at this point in the history
Fix totp retry
  • Loading branch information
aperrin66 authored Sep 25, 2023
2 parents 96808ef + 60c109f commit 5f04ca0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions geospaas_processing/downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,9 @@ def build_oauth2_authentication(cls, username, password, token_url, client_id,
'password': password,
'client_id': client_id,
}
if totp_secret:
session_args['totp'] = pyotp.TOTP(totp_secret).now()

try:
if totp_secret:
session_args['totp'] = pyotp.TOTP(totp_secret).now()
token = requests_oauthlib.OAuth2Session(client=client).fetch_token(**session_args)
except oauthlib.oauth2.rfc6749.errors.InvalidGrantError:
retries -= 1
Expand Down

0 comments on commit 5f04ca0

Please sign in to comment.