1 先创建session , 设置header. 调用get()函数
s = requests.session()
headers = {
‘Accept‘:‘image/webp,image/*;q=0.8‘,
‘User-Agent‘:‘News/6.9.8.36 CFNetwork/975.0.3 Darwin/18.2.0‘,
‘Accept-Language‘:‘zh-cn‘
}
s.headers.update(headers)
s.get(url=url,params=params,verify=False)
2 直接调用get
requests.get(url, headers=headers, proxies=proxies).text
原文地址:https://www.cnblogs.com/myd620/p/12253262.html
时间: 2024-11-09 08:38:51