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