Commit dfb30c47 authored by CepbluKot's avatar CepbluKot
Browse files

update

parent 0cd44f9a
......@@ -26,3 +26,28 @@ def location_from_coordinates(default_coordinates="52.509669, 13.376294"):
except:
return json.dumps(f"Cannot make location from coordinates ({default_coordinates})")
def location_from_address(default_location='Москва, Беговая, 17 к1'):
try:
location = geolocator.geocode(default_location)
if location is None:
return json.dumps("Cannot find this address")
return location.address, location.latitude, location.longitude
except:
return json.dumps("Cannot make location from address")
def location_from_coordinates(default_coordinates="52.509669, 13.376294"):
try:
location = geolocator.reverse(default_coordinates)
if location is None:
return json.dumps("Wrong coordinates")
return location.address, location.latitude, location.longitude
except:
return json.dumps(f"Cannot make location from coordinates ({default_coordinates})")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment