【发布时间】:2017-06-22 21:55:11
【问题描述】:
我有以下代码:
res = requests.get(url)
我使用多线程方法会出现以下错误:
ConnectionError: HTTPConnectionPool(host='bjtest.com', port=80): Max retries exceeded with url: /rest/data?method=check&test=123(原因:[Errno 104] Connection reset by peer)
我用了follow方法,还是报错:
s = requests.session()
s.keep_alive = False
或
res = requests.get(url, headers={'Connection': 'close'})
那么,我应该怎么做呢?
顺便说一句,url 是可以的,但它只能在内部访问,所以url 没有问题。谢谢!
【问题讨论】:
-
bjtest.com 可以访问吗?
-
@DuyNguyen 是的,但它只访问内部。