Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

转发出现json解析问题 #1

Open
827346462 opened this issue Mar 14, 2024 · 3 comments
Open

转发出现json解析问题 #1

827346462 opened this issue Mar 14, 2024 · 3 comments

Comments

@827346462
Copy link

通过hk server转发会出现json 解析错误。请问作者有遇到这个问题吗,已star

Traceback (most recent call last):
File "/root/miniconda3/envs/pyted/lib/python3.8/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/root/miniconda3/envs/pyted/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/root/miniconda3/envs/pyted/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/root/miniconda3/envs/pyted/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "bian_get_k_info.py", line 33, in
bookTicker_result = market.get_ticker_bookTicker()
File "/root/miniconda3/envs/pyted/lib/python3.8/site-packages/binance_interface/api/spot/spot_market.py", line 250, in get_ticker_bookTicker
return self.send_request(*_SPOTMarketEndpoints.get_ticker_bookTicker, **to_local(locals()))
File "/root/miniconda3/envs/pyted/lib/python3.8/site-packages/binance_interface/api/client.py", line 15, in wrapper2
result = func(*args, **kwargs)
File "/root/miniconda3/envs/pyted/lib/python3.8/site-packages/binance_interface/api/client.py", line 72, in send_request
data = response.json()
File "/root/miniconda3/envs/pyted/lib/python3.8/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

@pyted
Copy link
Owner

pyted commented Mar 14, 2024

首先Binance_resender我在实盘中也正在用,目前还算稳定。

对于这种报错怀疑是超出了权重,(现货1200,合约2400,官方有描述),导致返回的数据不是Json格式无法解析,对于这种问题的解决方式其实很简单,延时重试bookTicker_result = market.get_ticker_bookTicker()就可以

另外是我个人的建议,即使不适用代理,也会偶尔出现拔网线的情况,所以对于全部的API调用函数,应该都设置出现异常的行为路径,避免实盘服务器Down机。

@pyted
Copy link
Owner

pyted commented Mar 14, 2024

还有一个重要的原因,可能是你的proxy_host以'/'结尾了。

正确的写法:proxy_host = 'http://www.host.com'
错误的写法:proxy_host = 'http://www.host.com/'

@827346462
Copy link
Author

还有一个重要的原因,可能是你的proxy_host以'/'结尾了。

正确的写法:proxy_host = 'http://www.host.com' 错误的写法:proxy_host = 'http://www.host.com/'
是滴,可以加个V或者Q吗,请大佬喝点咖啡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants