报错内容:
requests.exceptions.ProxyError: HTTPConnectionPool(host=‘127.0.0.1‘, port=80): Max retries exceeded with url: http://xxxxx.com/login (Caused by ProxyError(‘Cannot connect to proxy.‘, NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x0000000004CDB9E8>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。‘)))
解决办法:
1、在请求前添加:
os.environ[‘NO_PROXY‘] = ‘423down.com‘
2、在请求前添加:
proxies = { "http": None, "https": None}
requests.get(url, param, proxies=proxies)
3、在请求前添加:
session = requests.Session()
session.trust_env = False
response = session.get(url, param)