Resolve mypy complaint and remove outdated code. (#3576)
* Resolve mypy complaint and remove outdated code. * Updated for new import
This commit is contained in:
Родитель
8ecb3c92f6
Коммит
4485cb9d82
|
@ -15,7 +15,7 @@
|
|||
|
||||
import logging
|
||||
|
||||
from google.oauth2 import id_token
|
||||
import google.oauth2.id_token
|
||||
from google.auth.transport import requests
|
||||
|
||||
from framework import basehandlers
|
||||
|
@ -31,13 +31,11 @@ class LoginAPI(basehandlers.APIHandler):
|
|||
self.abort(405, valid_methods=['POST'])
|
||||
|
||||
def do_post(self, **kwargs):
|
||||
# TODO(jrobbins): Remove id_token after next deployment.
|
||||
token = (self.get_param('id_token', required=False) or
|
||||
self.get_param('credential'))
|
||||
token = self.get_param('credential')
|
||||
message = "Unable to Authenticate. Please sign in again."
|
||||
|
||||
try:
|
||||
idinfo = id_token.verify_oauth2_token(
|
||||
idinfo = google.oauth2.id_token.verify_oauth2_token(
|
||||
token, requests.Request(),
|
||||
settings.GOOGLE_SIGN_IN_CLIENT_ID)
|
||||
users.add_signed_user_info_to_session(idinfo['email'])
|
||||
|
|
|
@ -2,7 +2,6 @@ import logging
|
|||
import os
|
||||
|
||||
from flask import session
|
||||
from google.oauth2 import id_token
|
||||
from google.auth.transport import requests
|
||||
|
||||
from framework import xsrf
|
||||
|
|
|
@ -21,7 +21,7 @@ from xml.dom import minidom
|
|||
import requests
|
||||
|
||||
from google.auth.transport import requests as reqs
|
||||
from google.oauth2 import id_token
|
||||
import google.oauth2.id_token
|
||||
|
||||
from framework import basehandlers
|
||||
from framework import rediscache
|
||||
|
@ -50,7 +50,7 @@ def _FetchMetrics(url):
|
|||
# https://cloud.google.com/appengine/docs/python/appidentity/#asserting_identity_to_other_app_engine_apps
|
||||
# GAE request limit is 60s, but it could go longer due to start-up latency.
|
||||
logging.info('Requesting metrics from: %r', url)
|
||||
token = id_token.fetch_id_token(reqs.Request(), url)
|
||||
token = google.oauth2.id_token.fetch_id_token(reqs.Request(), url)
|
||||
logging.info('token is %r', token)
|
||||
return requests.request(
|
||||
'GET', url, timeout=120.0, allow_redirects=False,
|
||||
|
|
Загрузка…
Ссылка в новой задаче