From 4dd0140f2c2fd0edc217db1f04a7eb64c23e9641 Mon Sep 17 00:00:00 2001 From: gleb Date: Sun, 25 Apr 2021 00:26:46 +0300 Subject: [PATCH] bugfixes --- glQiwiApi/core/aiohttp_custom_api.py | 1 + glQiwiApi/core/basic_requests_api.py | 10 ++++------ glQiwiApi/core/web_hooks/server.py | 4 ++-- tests/you_money_test.py | 10 +++++----- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/glQiwiApi/core/aiohttp_custom_api.py b/glQiwiApi/core/aiohttp_custom_api.py index 388bdc23..516827a8 100644 --- a/glQiwiApi/core/aiohttp_custom_api.py +++ b/glQiwiApi/core/aiohttp_custom_api.py @@ -39,6 +39,7 @@ def get_cached_session(self) -> Optional[aiohttp.ClientSession]: cached = self._cache[self._cached_key] if self.check_session(cached): return cached + return None def set_cached_session(self): cached_session = self.get_cached_session() diff --git a/glQiwiApi/core/basic_requests_api.py b/glQiwiApi/core/basic_requests_api.py index 35e73b4e..6588d8c6 100644 --- a/glQiwiApi/core/basic_requests_api.py +++ b/glQiwiApi/core/basic_requests_api.py @@ -53,7 +53,6 @@ async def _request( set_timeout: bool = True, cookies: Optional[LooseCookies] = None, json: Optional[dict] = None, - skip_exceptions: bool = False, data: Optional[Dict[str, Union[ str, int, List[ Union[str, int] @@ -105,11 +104,10 @@ async def _request( ClientProxyConnectionError, ServerDisconnectedError ) as ex: - if not skip_exceptions: - self.raise_exception( - status_code='400_special_bad_proxy', - json_info=ex - ) + self.raise_exception( + status_code='400_special_bad_proxy', + json_info=ex + ) return Response.bad_response() # Get content and return response try: diff --git a/glQiwiApi/core/web_hooks/server.py b/glQiwiApi/core/web_hooks/server.py index fa39c581..710e11ee 100644 --- a/glQiwiApi/core/web_hooks/server.py +++ b/glQiwiApi/core/web_hooks/server.py @@ -36,8 +36,8 @@ class QiwiWalletWebView(BaseWebHookView): """ - def _check_ip(self, ip: str) -> bool: - return _check_ip(ip) + def _check_ip(self, ip_address: str) -> bool: + return _check_ip(ip_address) async def parse_update(self) -> types.WebHook: """ diff --git a/tests/you_money_test.py b/tests/you_money_test.py index 7387e82b..3caf6eab 100644 --- a/tests/you_money_test.py +++ b/tests/you_money_test.py @@ -1,7 +1,7 @@ import unittest from glQiwiApi import YooMoneyAPI -from glQiwiApi.abstracts import AioTestCase +from glQiwiApi.core.abstracts import AioTestCase from glQiwiApi.types import Payment, AccountInfo, Operation TOKEN = 'some_token' @@ -9,7 +9,7 @@ class YooMoneyTest(AioTestCase): def setUp(self) -> None: - self.w = YooMoneyAPI(TOKEN) + self.wallet = YooMoneyAPI(TOKEN) async def test_build_url_to_get_token(self): url = await YooMoneyAPI.build_url_for_auth( @@ -27,11 +27,11 @@ async def test_get_access_token(self): self.assertEqual(isinstance(token, str), True) async def test_account_info(self) -> None: - account_info = await self.w.account_info() + account_info = await self.wallet.account_info() self.assertEqual(isinstance(account_info, AccountInfo), True) async def test_transaction_history(self) -> None: - transactions = await self.w.transactions() + transactions = await self.wallet.transactions() self.assertEqual( all( isinstance( @@ -39,7 +39,7 @@ async def test_transaction_history(self) -> None: ) for transaction in transactions), True) async def test_send(self): - payment = await self.w.send( + payment = await self.wallet.send( to_account='4100116633099701', protect=True, amount=2,