Files
python-VM/weather-cli/src/weather_cli/__init__.py
2019-11-25 18:13:52 +00:00

14 lines
350 B
Python

from .__version__ import __version__ # noqa
import requests
def current_weather(location, api_key):
url = 'https://api.openweathermap.org/data/2.5/weather'
query_params = {
'q': location,
'appid': api_key,
}
response = requests.get(url, params=query_params)
return response.json()['weather'][0]['description']