From 9e8899bce100917bd5805968cc43a9cc418f391e Mon Sep 17 00:00:00 2001 From: Paul Walko Date: Mon, 29 May 2017 17:28:14 -0400 Subject: [PATCH] remove old code & use format --- modules/weather.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/weather.py b/modules/weather.py index 89580fd..194ddc4 100644 --- a/modules/weather.py +++ b/modules/weather.py @@ -17,14 +17,11 @@ r_from = re.compile(r'(?i)([+-]\d+):00 from') def location(q): - uri = 'https://nominatim.openstreetmap.org/search?%s={query}&format=json' + uri = 'https://nominatim.openstreetmap.org/search?{type}={query}&format=json' if q.isdigit(): - uri = uri % 'postalcode' + uri = uri . format(type = 'postalcode', query = web.quote(q)) else: - uri = uri % 'q' - uri = uri . format(query = web.quote(q)) -# uri = 'https://nominatim.openstreetmap.org/search/?q={query}&format=json'.\ -# format(query=web.quote(q)) + uri = uri . format(type = 'q', query = web.quote(q)) results = web.get(uri) data = json.loads(results)