import requests
if __name__ == '__main__':
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'
}
url = 'http://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx'
data = {
'op': 'keyword',
'cname':'',
'pid':'',
'keyword': '北京',
'pageIndex': '1',
'pageSize': '10',
}
response = requests.post(url=url, data=data,headers=headers)
page_text = response.text
with open('./肯德基餐厅位置.html','w',encoding='utf-8') as fp:
fp.write(page_text)
print('over!!!')
网络爬虫——肯德基餐厅位置(requests)
最新推荐文章于 2024-08-19 14:41:29 发布