HuobiRDCenter / huobi_Python

Python SDK for Huobi Spot API
https://huobiapi.github.io/docs/spot/v1/en
Apache License 2.0
683 stars 333 forks source link

由於python 3.9 json的变更,部分代码会报错 #101

Open reece762 opened 3 years ago

reece762 commented 3 years ago
return cls(**kw).decode(s)

TypeError: init() got an unexpected keyword argument 'encoding'

暂时解决方法: site-packages\huobi\connection\impl\restapi_invoker.py", line 56, in call_sync dict_data = json.loads(response.text, encoding="utf-8")

在报错的代码中把代码里面的encoding删除:dict_data = json.loads(response.text)

求完美解决方法...毕竟一句句删不实际啊

liushooter commented 3 years ago

同样的bug The same bug

https://github.com/HuobiRDCenter/huobi_Python/blob/v2.3.0/huobi/connection/impl/restapi_invoker.py#L56

dict_data = json.loads(response.text, encoding="utf-8")

https://docs.python.org/3.8/library/json.html#json.loads

Deprecated since version 3.1, will be removed in version 3.9: encoding keyword argument

reece762 commented 3 years ago

同样的bug The same bug

https://github.com/HuobiRDCenter/huobi_Python/blob/v2.3.0/huobi/connection/impl/restapi_invoker.py#L56

dict_data = json.loads(response.text, encoding="utf-8")

https://docs.python.org/3.8/library/json.html#json.loads

Deprecated since version 3.1, will be removed in version 3.9: encoding keyword argument

对啊,原因就是json不再需要encoding了,导致新旧代码不兼容...我脑袋不行,得要个解决方法...

X-Mars commented 3 years ago

俺也一样。