yin_home/utils/query_weather.py
尹舟 f5834266e3 Revert "优化代码"
This reverts commit d1591e065b455f94f6ebdd8ba2c4947cad8845d5.
2025-02-11 18:48:50 +08:00

13 lines
388 B
Python

import requests
def query_weather(key="3add99f10c5144ebd64bfa0bfb6b1c20", city="420115", extensions="base", output="JSON"):
url = "https://restapi.amap.com/v3/weather/weatherInfo"
querystring = {"key": key, "city": city, "extensions": extensions,
"output": output}
response = requests.request("GET", url, params=querystring)
return response.json()