【Python学习】requests短连接
1 import requests 2 from requests.packages import urllib3 3 #SSL警告 4 urllib3.disable_warnings() 5 requests.adapters.DEFAULT_RETRIES =5 # 增加重连次数 6 7 s = requests.session() 8 s.keep_alive = False 9 10 resp = s.get(url=url, params=params, headers=headers, cookies=cookies, verify=False) 11 12 resp = s.post(url, json=post_data, headers=headers, cookies=cookies, verify=False) 13 s.close()
作者:gtea
博客地址:https://www.cnblogs.com/gtea