赞
踩
import requests
url = 'http://www.baidu.com/s'
headers = {
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.16 Safari/537.36",
}
params = {
'kw':'周冬雨'
}
resp = requests.get(url,headers=headers,params=params).content.decode()
print(resp)
但是结果出现了这种情况
import requests
url = 'http://www.baidu.com/s'
headers = {
"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.16 Safari/537.36",
}
params = {
'kw':'周冬雨'
}
resp = requests.get(url,headers=headers,params=params).content.decode()
print(resp)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。