From 0d867efc001b3794d36d8295ae0c114af0b3a161 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 19 Jun 2024 15:41:46 -0700 Subject: [PATCH] Update locationdata.py --- locationdata.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/locationdata.py b/locationdata.py index fb0af09..b10db08 100644 --- a/locationdata.py +++ b/locationdata.py @@ -9,6 +9,19 @@ def where_am_i(lat=0, lon=0): location = geolocator.reverse(lat+","+lon) address = location.raw['address'] - whereIam = address['house_number'] + " " + address['road'] + ", " + address['city'] + ", " + address['state'] + " " + address['postcode'] - + if 'house_number' in address: + whereIam += address['house_number'] + " " + if 'road' in address: + whereIam += address['road'] + ", " + if 'city' in address: + whereIam += address['city'] + ", " + if 'state' in address: + whereIam += address['state'] + " " + if 'postcode' in address: + whereIam += address['postcode'] + if 'county' in address: + whereIam += " " + address['county'] + if 'country' in address: + whereIam += " " + address['country'] + return whereIam \ No newline at end of file