|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
"""Get results of weather queries."""
|
|
|
|
|
import logging
|
|
|
|
|
import requests
|
|
|
|
|
from urllib.parse import quote
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
@ -9,7 +10,7 @@ logger = logging.getLogger(__name__)
|
|
|
|
|
def query_wttr_in(query):
|
|
|
|
|
"""Hit the wttr.in JSON API with the provided query."""
|
|
|
|
|
logger.info(f"about to query wttr.in with '{query}'")
|
|
|
|
|
response = requests.get(f'http://wttr.in/{query}?format=j1')
|
|
|
|
|
response = requests.get(f'http://wttr.in/{quote(query)}?format=j1')
|
|
|
|
|
response.raise_for_status()
|
|
|
|
|
|
|
|
|
|
weather_info = response.json()
|
|
|
|
|