http://www.czce.com.cn/portal/exchange/2015/datadaily/20151111.htm
为何这个地址抓到的结果是
b'<html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.
Your support ID is: 13212746783469538584</body></html>'
构建了一个常规的 header
请教。。谢谢。
1
linauror 2016-07-09 23:00:47 +08:00
设置 headers 即可,主要是 user_agent
|
2
okKO 2016-07-09 23:28:40 +08:00
|
3
Jblue 2016-07-10 10:03:04 +08:00
抓包分析一下
|
4
raycool 2016-07-10 16:02:18 +08:00
import requests
url='http://www.czce.com.cn/portal/exchange/2015/datadaily/20151111.htm' header = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17' } r= requests.get(url,headers=header) print r.text 我说网址这么顺眼,原来前东家。 |