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

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条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 11月4日
    • 已采纳回答 10月27日
    • 创建了问题 10月2日

    悬赏问题

    • ¥15 回答几个问题 关于数据库
    • ¥15 设计程序(标签-STM32|关键词-工作模式)
    • ¥15 51单片机串口通信问题,未完成且要修改
    • ¥15 百鸡问题 c++编程问题(相关搜索:输出数据)
    • ¥30 如何在CMD中设置代理
    • ¥15 我有一块薛定谔的硬盘
    • ¥15 微信小游戏开发2D碰撞检测问题
    • ¥30 MapReduce案例实践(实验过程需要截图加文字)
    • ¥30 链表、二叉树的应用和算法设计
    • ¥15 R语言批量修改csv文件中的某一列