Skip to content

Commit

Permalink
Merge pull request #42 from T0biii/patch-2
Browse files Browse the repository at this point in the history
speedup lookup
  • Loading branch information
GoliathLabs authored Jan 23, 2025
2 parents 306e59e + 8f3a44e commit b4777c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions unifi_respondd/unifi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,14 @@ def get_ap_channel_usage(ssids, cfg):

def get_location_by_address(address, app):
"""This function returns latitude and longitude of a given address."""
time.sleep(1)
try:
point = Point().from_string(address)
return point.latitude, point.longitude
except:
try:
return app.geocode(address).raw["lat"], app.geocode(address).raw["lon"]
time.sleep(1)
geocode = app.geocode(address)
return geocode.raw["lat"], geocode.raw["lon"]
except:
return get_location_by_address(address)

Expand Down

0 comments on commit b4777c9

Please sign in to comment.