import requests
import json
import pandas as pd
def request_hospital_data():
ak="换成自己的 AK" # 换成自己的 AK,需要申请
ct = ('衢州','宁波','台州','温州','丽水','杭州','湖州','金华')
keywords=('粥')
url = ["http://api.map.baidu.com/place/v2/search?query="+keywords+"&page_size=20&scope=1®ion=" + cs + "&output=json&ak=" + ak for cs in ct]
params = {'page_num':0} # 请求参数,页码
for url1 in url:
#print(url1)
request = requests.get(url1,params=params)
#print(request)# 请求数据
total = json.loads(request.text)['total'] # 数据的总条数
#print(total)
total_page_num = (total+19) // 20 # 每个页面大小是20,计算总页码
items = [] # 存