百度google还有csdn了好久,都说了解决requests max retries exceeded with url 的三个办法,就是
1, headers=要写成Connection": "close" ,2, keep_alive = False 3, requests.adapters.DEFAULT_RETRIES = 15
但是我都用上了还是报错,运行几分钟就断了。。
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='test.abcd..cn',
port=443): Max retries exceeded with url: /tess-wein/cot/cit (Caused
by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0
000000003910E88>: Failed to establish a new connection: [WinError 10060] A conne
ction attempt failed because the connected party did not properly respond after
a period of time, or established connection failed because connected host has fa
iled to respond'))
[Python] 纯文本查看复制代码
headers={
"Connection": "close",
}
while True:
requests.adapters.DEFAULT_RETRIES = 15
s = requests.session()
s.keep_alive = False
Response = requests.post(url,data=Dates,headers=headers,cookies=Cookies,stream=False)
time.sleep(5)