From 60985cbdfb170e563401f65652d5e6b8de88b959 Mon Sep 17 00:00:00 2001 From: ticaleenlx Date: Mon, 18 Jan 2021 01:37:36 +0800 Subject: [PATCH 1/2] Update restapi_invoker.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持3.9 --- huobi/connection/impl/restapi_invoker.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/huobi/connection/impl/restapi_invoker.py b/huobi/connection/impl/restapi_invoker.py index 4466abfd..806ee92f 100644 --- a/huobi/connection/impl/restapi_invoker.py +++ b/huobi/connection/impl/restapi_invoker.py @@ -2,6 +2,7 @@ from huobi.exception.huobi_api_exception import HuobiApiException from huobi.utils.etf_result import etf_result_check from huobi.utils import * +import sys import time from huobi.utils.print_mix_object import TypeCheck @@ -53,7 +54,10 @@ def call_sync(request, is_checked=False): response = session.get(request.host + request.url, headers=request.header) if is_checked is True: return response.text - dict_data = json.loads(response.text, encoding="utf-8") + if sys.version_info.major >= 3 and sys.version_info.minor >= 9: + dict_data = json.loads(response.text) + else: + dict_data = json.loads(response.text, encoding="utf-8") # print("call_sync === recv data : ", dict_data) check_response(dict_data) return request.json_parser(dict_data) From 6eddb57bd0adaefe5097a73b38a303c429d84158 Mon Sep 17 00:00:00 2001 From: ticaleenlx Date: Tue, 19 Jan 2021 18:12:16 +0800 Subject: [PATCH 2/2] Update account.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决#73代理问题,如api.huobi.be --- huobi/client/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/huobi/client/account.py b/huobi/client/account.py index 4b37c539..ef027a2a 100644 --- a/huobi/client/account.py +++ b/huobi/client/account.py @@ -54,7 +54,7 @@ def get_account_by_type_and_symbol(self, account_type, symbol): return None async def async_get_account_balance(self, balance_full_url, account_id, ret_map): - async with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False)) as session: async with session.get(balance_full_url) as resp: json = await resp.json() ret_map[account_id] = json