huobi_Python icon indicating copy to clipboard operation
huobi_Python copied to clipboard

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

Open reece762 opened this issue 3 years ago • 4 comments

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)

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

reece762 avatar Apr 13 '21 15:04 reece762

同样的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

liushooter avatar Apr 16 '21 04:04 liushooter

同样的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了,导致新旧代码不兼容...我脑袋不行,得要个解决方法...

reece762 avatar Apr 17 '21 06:04 reece762

俺也一样。

X-Mars avatar Apr 20 '21 08:04 X-Mars