Skip to content

Commit

Permalink
feat: improved ssl error handling or empty data
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikdevcom committed Oct 17, 2022
1 parent 7f52e17 commit da62f47
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cryptocom/exchange/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import json
import os
import random
import ssl
import time
from urllib.parse import urljoin

Expand Down Expand Up @@ -223,6 +224,7 @@ async def request(self, method, path, params=None, data=None, sign=False):
except (
asyncio.TimeoutError,
httpx.HTTPError,
ssl.SSLError,
json.JSONDecodeError,
) as exc:
if count == self.retries:
Expand All @@ -236,7 +238,10 @@ async def request(self, method, path, params=None, data=None, sign=False):

if resp_json["code"] == 0:
result = resp_json.get("result", {})
return result.get("data", {}) or result
result = result.get("data", {}) or result
if result is None:
continue
return result

if count == self.retries:
raise ApiError(
Expand Down

0 comments on commit da62f47

Please sign in to comment.