raise exceptions
This commit is contained in:
parent
4cb525ac11
commit
9899812fe7
@ -19,17 +19,17 @@ class YandexAuthView(BaseView):
|
||||
'code': code
|
||||
})
|
||||
if response.status_code != 200:
|
||||
self.logger.warning("Cant access, json: %s", response.json())
|
||||
raise Exception("Cant access, json: " + str(response.json()))
|
||||
return '/welcome'
|
||||
access_token = response.json().get('access_token')
|
||||
if access_token is None:
|
||||
self.logger.warning('no access token')
|
||||
raise Exception('no access token')
|
||||
return '/welcome'
|
||||
info_response = get('https://login.yandex.ru/info', headers={
|
||||
'Authorization': f'OAuth {access_token}'
|
||||
})
|
||||
if info_response.status_code != 200:
|
||||
self.logger.warning("Cant access, json: %s", response.json())
|
||||
raise Exception("Cant access, json: " + str(response.json()))
|
||||
return '/welcome'
|
||||
data = info_response.json()
|
||||
yandex_id = data['id']
|
||||
|
Loading…
Reference in New Issue
Block a user