import requests
key = "你的高德key"
city = "佛山"
types = "餐饮服务"
offset = 20 # 每页返回结果数,最大值为25
page = 1 # 当前页数,最大值为100
extensions = "base" # 返回结果控制,base返回基本信息,all返回详细信息
output = "JSON" # 返回数据格式类型,可选JSON,XML
url = f"https://restapi.amap.com/v3/place/text?key={key}&city={city}&types={types}&offset={offset}&page={page}&extensions={extensions}&output={output}"
response = requests.get(url)
data = response.json()
print(data["status"], data["count"])
for poi in data["pois"]:
print(poi["name"], poi["tel"])
声名:仅供学习参考,请勿用于非法用途