灰儿 发表于 2022-10-22 11:51:30

在python中使用requests 模拟浏览器发送请求数据的方法

在python中使用requests 模拟浏览器发送请求数据的方法

这期内容当中小编将会给大家带来有关怎么在python中使用requests 模拟浏览器发送请求,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

如下所示:

import requests

url='http://####'
proxy={'http':'http://####:80'}
headers={
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
"Connection":"keep-alive",
"Host":"36kr.com/newsflashes",
"Upgrade-Insecure-Requests":"1",
"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:55.0) Gecko/20100101 Firefox/55.0"
}
respone=requests.get(url,timeout=10,headers=headers,proxies=proxy)
print(respone.status_code)



上述就是小编为大家分享的怎么在python中使用requests 模拟浏览器发送请求了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。

页: [1]
查看完整版本: 在python中使用requests 模拟浏览器发送请求数据的方法