天气请求无法发送到打开的天气地图

时间:2019-07-10 07:50:36

标签: django openweathermap

我正在向openweathermap发送关于天气的请求,但无法发送给它。

从django.shortcuts导入渲染

导入请求

def索引(请求):

url = 'api.openweathermap.org/data/2.5/weather?q={}&units=imperial&appid=*************************'
city = 'lahore'
r = requests.get(url.format(city))
print(r.text)
return render(request,'weather/weather.html')

无效的URL'api.openweathermap.org/data/2.5/weather?q=lahore&units=imperial&appid=**********************':无架构提供。也许您是说http://api.openweathermap.org/data/2.5/weather?q=lahore&units=imperial&appid= ***************************?

Error Image

0 个答案:

没有答案
相关问题