问题遇到的现象和发生背景
import requests
url1 = 'https://www.runoob.com/wp-content/themes/runoob/option/alisearch/v330/hot_hint.php?type=hint&user_id=f3530de6-f57e-4400-b1fb-48240dd1bb9f'
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
'referer': 'https://www.runoob.com/xpath/xpath-syntax.html'
}
##################################################################################
res1 = requests.get(url1,headers=headers)
print(res1.json())
#...打印结果是[{'hint': 'indexof', 'pv': 94}]
##################################################################################
url2 = 'https://www.runoob.com/wp-content/themes/runoob/option/alisearch/v330/hot_hint.php?'
params = {
'type':' hint',
'user_id':'f3530de6-f57e-4400-b1fb-48240dd1bb9f',
}
res2 = requests.get(url2,params=params,headers=headers)
print(res2.json())
#...打印结果是None
为啥第一种方式能得到请求网址的响应代码,但是第二种方式就得不到结果呢?