您的位置:首页 > 编程语言 > Python开发

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

2018-01-12 00:23 876 查看
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)

不扯淡,直接上代码!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  requests python