Initial upload
This commit is contained in:
commit
bf8a8f965d
7 changed files with 77 additions and 0 deletions
12
weather_request.py
Normal file
12
weather_request.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import os
|
||||
import requests
|
||||
from pprint import pprint
|
||||
from decouple import config
|
||||
|
||||
key = config('WEATHER_API_KEY')
|
||||
city = input("Enter a city: ")
|
||||
base_url = f"http://api.openweathermap.org/data/2.5/weather?appid={key}&q={city}"
|
||||
weather_data = requests.get(base_url).json()
|
||||
|
||||
# pprint(weather_data)
|
||||
print(weather_data['weather'][0]['description'])
|
||||
Loading…
Add table
Add a link
Reference in a new issue