From 3a21f61559d671d3b65d504d4e0b61197ddcabfc Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 5 May 2022 12:08:18 +0100 Subject: [PATCH] Remove redundant code --- handler/lib/agoradesk_py.py | 12 ++++++------ handler/lib/localbitcoins_py.py | 31 ------------------------------- 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/handler/lib/agoradesk_py.py b/handler/lib/agoradesk_py.py index 70346af..0ac0168 100644 --- a/handler/lib/agoradesk_py.py +++ b/handler/lib/agoradesk_py.py @@ -159,12 +159,12 @@ class AgoraDesk: """ return self._api_call(api_method=f"account_info/{username}") - def dashboard(self) -> Dict[str, Any]: - """See Agoradesk API. + # def dashboard(self) -> Dict[str, Any]: + # """See Agoradesk API. - https://agoradesk.com/api-docs/v1#operation/getUserDashboard - """ - return self._api_call(api_method="dashboard") + # https://agoradesk.com/api-docs/v1#operation/getUserDashboard + # """ + # return self._api_call(api_method="dashboard") def dashboard_buyer(self) -> Dict[str, Any]: """See Agoradesk API. @@ -173,7 +173,7 @@ class AgoraDesk: """ return self._api_call(api_method="dashboard/buyer") - def dashboard_seller(self) -> Dict[str, Any]: + def dashboard(self) -> Dict[str, Any]: """See Agoradesk API. https://agoradesk.com/api-docs/v1#operation/getUserDashboardSeller diff --git a/handler/lib/localbitcoins_py.py b/handler/lib/localbitcoins_py.py index 222f6e4..26603b3 100644 --- a/handler/lib/localbitcoins_py.py +++ b/handler/lib/localbitcoins_py.py @@ -188,37 +188,6 @@ class LocalBitcoins: response.addCallback(self.callback_api_call, result) return response - session = requests.Session() - try: - response = session.send(api_request) - response_json = response.json() - result["response"] = response_json - result["status"] = response.status_code - if response.status_code == 200: - result["success"] = True - result["message"] = "OK" - else: - result["message"] = "API ERROR" - return result - - except requests.ConnectionError as error: - result["message"] = str(error) - result["status"] = 600 - result["response"] = {"error": {"message": error}} - return result - except json.decoder.JSONDecodeError: - result["message"] = "Not JSON" - if response: - result["status"] = response.status_code - result["response"] = {"error": {"message": response.text}} - return result - except requests.ReadTimeout: - result["message"] = "Read timed out" - if response: - result["status"] = response.status_code - result["response"] = {"error": {"message": response.text}} - return result - # Account related API Methods # ===========================