肯德基餐厅信息查询网址:http://www.kfc.com.cn/kfccda/storelist/index.aspx
import requests
url = 'http://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx?op=cname'
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.100 Safari/537.36'
}
address = input('您想查询哪个城市:')
for i in range(1,4):#拿前三页数据
data = {
'cname': address,
'pid':'' ,
'pageIndex': str(i),
'pageSize': '10',
}
response = requests.post(url=url,data=data,headers=headers).json()
#print(response)
for dic in response['Table1']:
_storeName = dic['storeName']
_addressDetail = dic['addressDetail']
print(_storeName+_addressDetail)
Original: https://www.cnblogs.com/qimu666/p/16565715.html
Author: 柒木木木
Title: 3_肯德基餐厅信息查询_动态加载_post请求
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/598762/
转载文章受原作者版权保护。转载请注明原作者出处!