Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
arithmetic1728 committed Mar 30, 2021
1 parent 740d6c6 commit bdc9bad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
7 changes: 1 addition & 6 deletions google/oauth2/_client.py
Expand Up @@ -23,11 +23,6 @@
.. _Section 3.1 of rfc6749: https://tools.ietf.org/html/rfc6749#section-3.2
"""

try:
from collections.abc import Mapping
# Python 2.7 compatibility
except ImportError: # pragma: NO COVER
from collections import Mapping
import datetime
import json

Expand Down Expand Up @@ -112,7 +107,7 @@ def _token_endpoint_request_no_throw(
body = urllib.parse.urlencode(body).encode("utf-8")

if access_token:
headers["Authorization"] = f"Bearer {access_token}"
headers["Authorization"] = "Bearer {}".format(access_token)

retry = 0
# retry to fetch token for maximum of two times if any internal failure
Expand Down
3 changes: 1 addition & 2 deletions google/oauth2/challenges.py
Expand Up @@ -19,7 +19,6 @@
import base64
import getpass
import sys
import warnings

import six

Expand Down Expand Up @@ -97,7 +96,7 @@ def obtain_challenge_input(self, metadata):
import pyu2f.convenience.authenticator
import pyu2f.errors
import pyu2f.model
except ImportError as e:
except ImportError:
sys.stderr.write(
"pyu2f is missing. Please install pyu2f to use Security key reauth feature."
)
Expand Down
10 changes: 5 additions & 5 deletions google/oauth2/reauth.py
Expand Up @@ -32,13 +32,13 @@
3. Refreshing the access token using the returned rapt token.
"""

import json
import sys

from six.moves import range

from google.auth import exceptions
from google.oauth2 import challenges
from google.oauth2 import _client
from six.moves import range
from google.oauth2 import challenges


_REAUTH_SCOPE = "https://www.googleapis.com/auth/accounts.reauth"
Expand Down Expand Up @@ -104,7 +104,7 @@ def _send_challenge_result(

return _client._token_endpoint_request(
request,
_REAUTH_API + f"/{session_id}:continue",
_REAUTH_API + "/{}:continue".format(session_id),
body,
access_token=access_token,
use_json=True,
Expand Down Expand Up @@ -198,7 +198,7 @@ def _obtain_rapt(request, access_token, requested_scopes, rounds_num=5):
msg["status"] == _CHALLENGE_REQUIRED or msg["status"] == _CHALLENGE_PENDING
):
raise exceptions.ReauthFailError(
f"Reauthentication challenge failed due to API error: {0}".format(
"Reauthentication challenge failed due to API error: {}".format(
msg["status"]
)
)
Expand Down

0 comments on commit bdc9bad

Please sign in to comment.