import requests
url = 'http://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx?op=keyword'
data = {
'cname':'',
'pid':'',
'keyword': '北京',
'pageIndex': '1',
'pageSize': '10'
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.63'
}
response = requests.post(url=url,data=data,headers=headers)
page_text = response.text
print(page_text)
with open('./KFC.html','w',encoding='utf-8') as f:
f.write(page_text)
print('保存成功!!')
requests应用之肯德基!
最新推荐文章于 2024-08-21 23:42:00 发布