TypeError:'dict'对象在Python中不可调用

问题描述 投票:0回答:1

此方法我使用键和参数以字典形式调用Weather API,但其在行中抛出错误:

response = request.GET(url, params=params)

TypeError:'dict'对象不可调用

def get_weather():
print('this is the weather')
user = entry.get()
key = '6557bbd7dbca062ddf4fe0XXXXXX'
# api.openweathermap.org/data/2.5/weather?q={city name},{country code}
url = 'https://api.openweathermap.org/data/2.5/weather'
params = {'APPID':key, 'q': user, 'units':'metric'}
response = request.GET(url, params=params)
#print(response.JSON())  this also didn't worked
return jsonify(response.JSON())
json dictionary tkinter response callable
1个回答
0
投票

解决方案:响应= request.GET(URL,params = params)

© www.soinside.com 2019 - 2024. All rights reserved.