小白鼠1024
2021-10-02 18:50
采纳率: 100%
浏览 30
已结题

requests发送post请求报错

requests发送post请求报错如下

Traceback (most recent call last):
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\urllib3\connectionpool.py", line 706, in urlopen
    chunked=chunked,
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Jerry\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1354, in getresponse
    response.begin()
  File "C:\Users\Jerry\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Jerry\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 275, 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 "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\requests\adapters.py", line 449, in send
    timeout=timeout
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\urllib3\connectionpool.py", line 756, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\urllib3\util\retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\urllib3\packages\six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\urllib3\connectionpool.py", line 706, in urlopen
    chunked=chunked,
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\Jerry\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1354, in getresponse
    response.begin()
  File "C:\Users\Jerry\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Jerry\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 275, 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 "C:/Users/Jerry/PycharmProjects/pythonProject/use.py", line 10, in <module>
    r = requests.post('http://www.lzswfww.cn/cxzx/zkcx/zkcxxq.html', data=d, headers=haaders)
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\requests\api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Jerry\PycharmProjects\pythonProject\venv\lib\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'))
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题