python爬虫出现这个错误-HTTPSConnectionPool(host='a', port=443): Max retries exceeded with url: /b/c (

运行就报这个错误
HTTPSConnectionPool(host='xxxx', port=443): Max retries exceeded with url: /xx/xxx (Caused by ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')))
在win11电脑用pychram中正常运行,但是放到linux服务器上就报这个错误,
报错的,请求运行代码
response = requests.get('https://xxxx', headers=headers,proxies=proxy,verify=False)
必须要使用代理,服务器ip被对方服务器拉黑了

这个有两种可能:.http连接太多没有关闭导致的、、、访问次数频繁,被禁止访问
1.http连接太多没有关闭导致的,解决方法:

import requests
requests.adapters.DEFAULT_RETRIES = 5 # 增加重连次数
s = requests.session()
s.keep_alive = False # 关闭多余连接
s.get(url) # 你需要的网址

2.访问次数频繁,被禁止访问,解决方法:使用代理

import requests
s = requests.session()
url = "https://mail.163.com/"
s.proxies = {"https": "47.100.104.247:8080", "http": "36.248.10.47:8080", }
s.headers = header
s.get(url)