python断开管道请求lib

时间:2016-12-10 01:49:20

标签: python bash

我正在运行一个问题,如果我从我的计算机上运行我的脚本它运行良好,但当脚本在BASH的另一台服务器上运行时它会返回:

Traceback (most recent call last):
  File "/home/project/venv/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/home/project/venv/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 361, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 936, in _send_output
    self.send(message_body)
  File "/usr/lib/python3.5/http/client.py", line 908, in send
    self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe

我正在做什么:

for i in range(1, 5):
html_content = session.post('http://example.com/content.html', data=d, cookies=session.cookies.get_dict(), headers=headers)

我正在接收我需要迭代的每个页面的AJAX HTML结果,我到达第2页但是当他尝试获取第三页时出现错误。

0 个答案:

没有答案