remove old code & use format
parent
d8eefde17e
commit
9e8899bce1
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue