request.exceptions.ConnectionError :(“连接已中止。”,RemoteDisconnected(“远端封闭的无响应的连接”)

时间:2020-02-03 20:40:41

标签: python-3.x macos connection

任何人都知道如何解决此错误? 我正在尝试下载数据,并且已将posgresql服务器与数据库导航器连接为localhost。文件成功下载了大约3分钟,然后突然下载停止并返回此错误消息:

.
..
...
run_filing 201500419349300305
run_filing 201540439349301594
Traceback (most recent call last):
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/urllib3/util/retry.py", line 400, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.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 "/Users/Georg/PycharmProjects/990-xml-database/irsdb/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "/Users/Georg/PycharmProjects/990-xml-database/irsdb/return/management/commands/load_filings.py", line 123, in handle
    self.run_filing(filing)
  File "/Users/Georg/PycharmProjects/990-xml-database/irsdb/return/management/commands/load_filings.py", line 65, in run_filing
    parsed_filing = self.xml_runner.run_filing(object_id)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/irsx/xmlrunner.py", line 111, in run_filing
    this_filing.process(verbose=verbose)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/irsx/filing.py", line 232, in process
    self._download(verbose=verbose)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/irsx/filing.py", line 70, in _download
    stream_download(self.URL, self.filepath, verbose=verbose)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/irsx/file_utils.py", line 22, in stream_download
    response = requests.get(url, stream=True)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/Users/Georg/PycharmProjects/990-xml-database/venv/lib/python3.6/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

随附的是connectionpool.py代码的屏幕截图。 enter image description here

0 个答案:

没有答案