1. 遇到这种错误有可能是机器无外网权限造成的。
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘‘, port=443): Max retries exceeded with url: /s/savecomtajax (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f972f48bf90>: Failed to establish a new connection: [Errno 110] Connection timed out‘,))
2. requests 发https 请求时,需要忽略证书的验证, 需要注意如下点。
requests.packages.urllib3.disable_warnings()
def request_ajax_url(login_url,login_body, headers):
‘‘‘发送post请求数据‘‘‘
req = requests.post(login_url, data=login_body, headers=headers, verify=False);
return req.text
原文:http://www.cnblogs.com/lwrjiayou/p/6645287.html