1、问题描述:
迭代请求http web服务,中途遇到异常报错:
requests.exceptions.SSLError: HTTPSConnectionPool(host='xxx.com', port=443): Max retries exceeded with url:xxx
2、问题排查
# 源代码
response = requests.request("POST", url=url, headers=headers, data=payload)
3、问题原因:
http的连接数超过最大限制。默认的情况下连接是keep-alive的,所以导致服务器保持了太多连接而不能再新建连接
4、解决方法:
每次请求完成后,主动关闭请求文章来源:https://www.toymoban.com/news/detail-527987.html
response = requests.request("POST", url=url, headers=headers, data=payload)
response.close()
参考:爬虫遇到 HTTPSConnectionPool(host=‘xxxxx‘, port=443) 解决思路_自学AI的鲨鱼儿的博客-CSDN博客_port=443文章来源地址https://www.toymoban.com/news/detail-527987.html
到了这里,关于http请求报错SSLError: HTTPSConnectionPool:Max retries exceeded with url的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!