好友
阅读权限10
听众
最后登录1970-1-1
|
import requests
url = 'https://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx?op=keyword'
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36'
}
word = input('enter a word:')
data = {
'cname': '',
'pid': '',
'keyword': word,
'pageIndex': '1',
'pageSize': '10',
}
response = requests.post(url=url, headers=headers, data=data)
list_data = response.json()
for dic in list_data['Table1']:
print(dic['storeName'], dic['addressDetail']) |
|