From 9899812fe7730fe79327a276b5ab6a43e2af58c3 Mon Sep 17 00:00:00 2001 From: Administrator Date: Tue, 10 Oct 2023 00:01:33 +0300 Subject: [PATCH] raise exceptions --- web/views/yandex_auth.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/views/yandex_auth.py b/web/views/yandex_auth.py index ca7b07e..c4233e4 100644 --- a/web/views/yandex_auth.py +++ b/web/views/yandex_auth.py @@ -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']