求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限
efinance版本0.5.5.2 求助 运行以下时 import efinance as ef panel00= ef.stock.get_quote_history('600519')
报错: runfile('C:/Users/Sam/Desktop/etf动量/未命名2.py', wdir='C:/Users/Sam/Desktop/etf动量') Traceback (most recent call last):
File ~\anaconda3\lib\site-packages\urllib3\connectionpool.py:715 in urlopen httplib_response = self._make_request(
File ~\anaconda3\lib\site-packages\urllib3\connectionpool.py:467 in _make_request six.raise_from(e, None)
File
File ~\anaconda3\lib\site-packages\urllib3\connectionpool.py:462 in _make_request httplib_response = conn.getresponse()
File ~\anaconda3\lib\http\client.py:1347 in getresponse response.begin()
File ~\anaconda3\lib\http\client.py:307 in begin version, status, reason = self._read_status()
File ~\anaconda3\lib\http\client.py:276 in _read_status raise RemoteDisconnected("Remote end closed connection without"
RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ~\anaconda3\lib\site-packages\requests\adapters.py:667 in send resp = conn.urlopen(
File ~\anaconda3\lib\site-packages\urllib3\connectionpool.py:829 in urlopen return self.urlopen(
File ~\anaconda3\lib\site-packages\urllib3\connectionpool.py:829 in urlopen return self.urlopen(
File ~\anaconda3\lib\site-packages\urllib3\connectionpool.py:829 in urlopen return self.urlopen(
File ~\anaconda3\lib\site-packages\urllib3\connectionpool.py:829 in urlopen return self.urlopen(
File ~\anaconda3\lib\site-packages\urllib3\connectionpool.py:829 in urlopen return self.urlopen(
File ~\anaconda3\lib\site-packages\urllib3\connectionpool.py:801 in urlopen retries = retries.increment(
File ~\anaconda3\lib\site-packages\urllib3\util\retry.py:594 in increment raise MaxRetryError(_pool, url, error or ResponseError(cause))
MaxRetryError: HTTPSConnectionPool(host='push2his.eastmoney.com', port=443): Max retries exceeded with url: /api/qt/stock/kline/get?fields1=f1%2Cf2%2Cf3%2Cf4%2Cf5%2Cf6%2Cf7%2Cf8%2Cf9%2Cf10%2Cf11%2Cf12%2Cf13&fields2=f51%2Cf52%2Cf53%2Cf54%2Cf55%2Cf56%2Cf57%2Cf58%2Cf59%2Cf60%2Cf61&beg=19000101&end=20500101&rtntype=6&secid=1.600519&klt=101&fqt=1 (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ~\anaconda3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec exec(code, globals, locals)
File c:\users\sam\desktop\etf动量\未命名2.py:14 panel00= ef.stock.get_quote_history('600519')
File ~\anaconda3\lib\site-packages\efinance\stock\getter.py:299 in get_quote_history df = get_quote_history_for_stock(
File ~\anaconda3\lib\site-packages\efinance\common\getter.py:288 in get_quote_history return get_quote_history_single(
File ~\anaconda3\lib\site-packages\efinance\utils_init_.py:48 in run values = func(*args, **kwargs)
File ~\anaconda3\lib\site-packages\efinance\common\getter.py:152 in get_quote_history_single json_response = session.get(
File ~\anaconda3\lib\site-packages\requests\sessions.py:602 in get return self.request("GET", url, **kwargs)
File ~\anaconda3\lib\site-packages\efinance\shared_init_.py:14 in request return super(CustomedSession, self).request(*args, **kwargs)
File ~\anaconda3\lib\site-packages\requests\sessions.py:589 in request resp = self.send(prep, **send_kwargs)
File ~\anaconda3\lib\site-packages\requests\sessions.py:703 in send r = adapter.send(request, **kwargs)
File ~\anaconda3\lib\site-packages\requests\adapters.py:700 in send raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='push2his.eastmoney.com', port=443): Max retries exceeded with url: /api/qt/stock/kline/get?fields1=f1%2Cf2%2Cf3%2Cf4%2Cf5%2Cf6%2Cf7%2Cf8%2Cf9%2Cf10%2Cf11%2Cf12%2Cf13&fields2=f51%2Cf52%2Cf53%2Cf54%2Cf55%2Cf56%2Cf57%2Cf58%2Cf59%2Cf60%2Cf61&beg=19000101&end=20500101&rtntype=6&secid=1.600519&klt=101&fqt=1 (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')))
I got the same issue : requests.exceptions.ConnectionError: HTTPSConnectionPool(host='push2his.eastmoney.com', port=443): Max retries exceeded with url: /api/qt/stock/kline/get?fields1=f1%2Cf2%2Cf3%2Cf4%2Cf5%2Cf6%2Cf7%2Cf8%2Cf9%2Cf10%2Cf11%2Cf12%2Cf13&fields2=f51%2Cf52%2Cf53%2Cf54%2Cf55%2Cf56%2Cf57%2Cf58%2Cf59%2Cf60%2Cf61&beg=20240101&end=20500101&rtntype=6&secid=0.159892&klt=101&fqt=1 (Caused by ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)))
+1
服务端那边近期开始对行情相关接口进行了限流,频繁访问会导致ip被暂时被封,目前除了控制访问频率或者加个动态代理,暂时没有其他解决方案。
你好,我对使用代理方式不是很熟悉,能否推荐一个可用的代理服务器? 谢谢
---原始邮件--- 发件人: @.> 发送时间: 2025年4月24日(周四) 下午2:59 收件人: @.>; 抄送: @.@.>; 主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
Micro-sheep left a comment (Micro-sheep/efinance#208)
服务端那边近期开始对行情相关接口进行了限流,频繁访问会导致ip被暂时被封,目前除了控制访问频率或者加个动态代理,暂时没有其他解决方案。
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
你好,我对使用代理方式不是很熟悉,能否推荐一个可用的代理服务器? 谢谢
---原始邮件---
发件人: @.***>
发送时间: 2025年4月24日(周四) 下午2:59
收件人: @.***>;
抄送: @.@.>;
主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
Micro-sheep left a comment (Micro-sheep/efinance#208)
服务端那边近期开始对行情相关接口进行了限流,频繁访问会导致ip被暂时被封,目前除了控制访问频率或者加个动态代理,暂时没有其他解决方案。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>
关键词 隧道代理。
不过用代理还是有点麻烦的,如果只是需要获取k线数据,可以试试 baostock 这个库。
谢谢回复。暂时还是想仍使用efinance, 你确定它是封完会恢复吗?我是昨天被封的,今天一天都不能用,我其实只是15分钟取一次数并不频繁啊。我从办公室WIFI换成手机热点,就可以用了,所以它也不是用mac地址来识别。
---原始邮件--- 发件人: @.> 发送时间: 2025年4月24日(周四) 下午4:56 收件人: @.>; 抄送: @.@.>; 主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
Micro-sheep left a comment (Micro-sheep/efinance#208)
你好,我对使用代理方式不是很熟悉,能否推荐一个可用的代理服务器? 谢谢
---原始邮件---
发件人: @.***>
发送时间: 2025年4月24日(周四) 下午2:59
收件人: @.***>;
抄送: @.@.>;
主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
Micro-sheep left a comment (#208)
服务端那边近期开始对行情相关接口进行了限流,频繁访问会导致ip被暂时被封,目前除了控制访问频率或者加个动态代理,暂时没有其他解决方案。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: @.***>
关键词 隧道代理。
不过用代理还是有点麻烦的,如果只是需要获取k线数据,可以试试 baostock 这个库。
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
谢谢回复。暂时还是想仍使用efinance, 你确定它是封完会恢复吗?我是昨天被封的,今天一天都不能用,我其实只是15分钟取一次数并不频繁啊。我从办公室WIFI换成手机热点,就可以用了,所以它也不是用mac地址来识别。 …
15分钟访问一次也会被封吗
是的,但我有3个程序同时跑,每个程序每15分钟取约90个标的的数据。现在的问题是被封时的网封到现在也没回复。
---原始邮件--- 发件人: @.> 发送时间: 2025年4月25日(周五) 下午4:18 收件人: @.>; 抄送: @.@.>; 主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
OkabeRintarou left a comment (Micro-sheep/efinance#208)
谢谢回复。暂时还是想仍使用efinance, 你确定它是封完会恢复吗?我是昨天被封的,今天一天都不能用,我其实只是15分钟取一次数并不频繁啊。我从办公室WIFI换成手机热点,就可以用了,所以它也不是用mac地址来识别。 …
15分钟访问一次也会被封吗
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
是的,但我有3个程序同时跑,每个程序每15分钟取约90个标的的数据。现在的问题是被封时的网封到现在也没回复。 …
请问一下如何在代码里面加代理?
Bypass的方法是每2000次访问暂停10分钟
---原始邮件--- 发件人: @.> 发送时间: 2025年5月21日(周三) 下午3:26 收件人: @.>; 抄送: @.@.>; 主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
leolle520 left a comment (Micro-sheep/efinance#208)
是的,但我有3个程序同时跑,每个程序每15分钟取约90个标的的数据。现在的问题是被封时的网封到现在也没回复。 …
请问一下如何在代码里面加代理?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
我的系统也完蛋了,只能用其他库了。
Bypass的方法是每2000次访问暂停10分钟 …
测试过吗,还是有官方通知。我前几天一直不能访问,到现在可以偶尔连续请求一段时间,但是量大了就不让了。
我上次说得不对,现在每访问一次sleep 1秒,比较慢但有效。
---原始邮件--- 发件人: @.> 发送时间: 2025年5月29日(周四) 下午4:42 收件人: @.>; 抄送: @.@.>; 主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
leolle520 left a comment (Micro-sheep/efinance#208)
Bypass的方法是每2000次访问暂停10分钟 …
测试过吗,还是有官方通知。我前几天一直不能访问,到现在可以偶尔连续请求一段时间,但是量大了就不让了。
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
我上次说得不对,现在每访问一次sleep 1秒,比较慢但有效。 … 现在还能用吗 只能靠sleep解决?
目前就是这样解决的
---原始邮件--- 发件人: @.> 发送时间: 2025年6月2日(周一) 下午2:24 收件人: @.>; 抄送: @.@.>; 主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
henry991217 left a comment (Micro-sheep/efinance#208)
我上次说得不对,现在每访问一次sleep 1秒,比较慢但有效。 … 现在还能用吗 只能靠sleep解决?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
目前就是这样解决的 …
请教一下 是直接在源码中增加sleep吗 因为我是一次性调用的quote_history 直接塞个股票代码列表进去 基本上调用到300多个个股就封了 这个函数封装好了 想要sleep只能在作者库的源码上面改啊
才知道可以一批调用。我一次调用是一个股票代码,列表自己循环控制,所以可以加sleep.
---原始邮件--- 发件人: @.> 发送时间: 2025年6月2日(周一) 下午5:09 收件人: @.>; 抄送: @.@.>; 主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
henry991217 left a comment (Micro-sheep/efinance#208)
目前就是这样解决的 …
请教一下 是直接在源码中增加sleep吗 因为我是一次性调用的quote_history 直接塞个股票代码列表进去 基本上调用到300多个个股就封了 这个函数封装好了 想要sleep只能在作者库的源码上面改啊
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
才知道可以一批调用。我一次调用是一个股票代码,列表自己循环控制,所以可以加sleep. …
是啊 但这样运行效率会比较差 所以我改成批量调用了 结果现在反而只能再重新用回逐个调用了QAQ
今天啥情况啊,1000次调用就被封了,以往加sleep 全部5000多股票可以扫一遍也没问题
---原始邮件--- 发件人: @.> 发送时间: 2025年6月3日(周二) 下午2:37 收件人: @.>; 抄送: @.@.>; 主题: Re: [Micro-sheep/efinance] 求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限 (Issue #208)
henry991217 left a comment (Micro-sheep/efinance#208)
才知道可以一批调用。我一次调用是一个股票代码,列表自己循环控制,所以可以加sleep. …
是啊 但这样运行效率会比较差 所以我改成批量调用了 结果现在反而只能再重新用回逐个调用了QAQ
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
应该无解了 东财服务器限流越来越严重 这个库可能也得废