json.load()不返回任何内容

时间:2020-05-09 08:26:28

标签: json python-requests

请在下面提供帮助,我正在尝试从天气API中提取Json数据;但是当我打电话给json.load()时,它什么也没返回:

def get_weather_from_api(location_id):
    api_key = ''
    url = f'http://dataservice.accuweather.com/currentconditions/v1/{location_id}?apikey={api_key}&language=en-us&details=false'

    response = requests.get(url)

    data = json.load(response.text)
    print(data)

0 个答案:

没有答案