KFC定点查询(输入城市名称即可查询)
import requests
from lxml import etree
import time
url = 'http://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx?op=keyword'
city = input("Please enter the city:")
data = {"cname": "","pid":"", "keyword": city,"pageIndex": "1","pageSize": "10",
}
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36"
}
response = requests.post(url=url,headers=headers,data=data).json()
response