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

retry when connection error happened #1

Open
yanxurui opened this issue Dec 2, 2020 · 0 comments
Open

retry when connection error happened #1

yanxurui opened this issue Dec 2, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@yanxurui
Copy link
Owner

yanxurui commented Dec 2, 2020

Traceback (most recent call last):
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/home/yxr/.pyenv/versions/3.8.1/lib/python3.8/http/client.py", line 1322, in getresponse
    response.begin()
  File "/home/yxr/.pyenv/versions/3.8.1/lib/python3.8/http/client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "/home/yxr/.pyenv/versions/3.8.1/lib/python3.8/http/client.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/home/yxr/.pyenv/versions/3.8.1/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/urllib3/util/retry.py", line 410, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/home/yxr/.pyenv/versions/3.8.1/lib/python3.8/http/client.py", line 1322, in getresponse
    response.begin()
  File "/home/yxr/.pyenv/versions/3.8.1/lib/python3.8/http/client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "/home/yxr/.pyenv/versions/3.8.1/lib/python3.8/http/client.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/home/yxr/.pyenv/versions/3.8.1/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "fund.py", line 102, in main
    fund = Fund(fund_code)
  File "fund.py", line 30, in __init__
    self.name, self.worth = self.download(fund_code)
  File "fund.py", line 40, in download
    r = requests.get(url)
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/home/yxr/.pyenv/versions/invest/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
@yanxurui yanxurui added the enhancement New feature or request label Dec 2, 2020
@yanxurui yanxurui self-assigned this Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant