【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()

 

posted @ 2020-04-10 12:55  gtea  阅读(1265)  评论(0编辑  收藏  举报