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