diff --git a/pybitflyer/async.py b/pybitflyer/async.py index 8c8fc5e..c6cfd4e 100644 --- a/pybitflyer/async.py +++ b/pybitflyer/async.py @@ -50,12 +50,16 @@ async def request(self, endpoint, method="GET", params=None): try: if method == 'GET': async with s.get(url, params=params, timeout=self.timeout, headers=header) as r: - contents_json = await r.json() - return contents_json + contents = await r.text() + if len(contents) > 0: + contents = json.loads(contents) + return contents else: # method == "POST": async with s.post(url, data=json.dumps(params), timeout=self.timeout, headers=header) as r: - contents_json = await r.json() - return contents_json + contents = await r.text() + if len(contents) > 0: + contents = json.loads(contents) + return contents except Exception as e: print(e) raise e