The saddest thing is that|

柒木木木

园龄:2年8个月粉丝:9关注:0

3_肯德基餐厅信息查询_动态加载_post请求

肯德基餐厅信息查询网址: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)

 

本文作者:柒木木木

本文链接:https://www.cnblogs.com/qimu666/p/16565715.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   柒木木木  阅读(189)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起