Micro-sheep / Micro-sheep/efinance
求助,多次运行 ef.stock.get_quote_history时报错连接中止,第二日可恢复,次数受限
- Dominant language
- Python
- Stars
- 4.1k
- Forks
- 755
- PR merge metrics
- No merged PRs in 30d
Description
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 :3 in raise_from
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')))
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at efinance/stock/getter.py:get_quote_history and follow the call into efinance/common/getter.py:get_quote_history_single, then inspect the request path in efinance/shared/__init__.py. Reproduce the repeated request against push2his.eastmoney.com and determine the expected behavior when the remote endpoint closes the connection. Done should include a verified resolution or a clearly documented limitation and test evidence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100