Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,7 +50,12 @@ def get_location_tool(ip: str): str
|
|
| 50 |
|
| 51 |
Returns: ip address, city, region, country, and geo coordinates
|
| 52 |
"""
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
response = DbIpCity.get(ip, api_key='free')
|
| 55 |
|
| 56 |
|
|
@@ -74,7 +79,7 @@ try:
|
|
| 74 |
|
| 75 |
# Get current time in that timezone
|
| 76 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 77 |
-
|
| 78 |
except Exception as e:
|
| 79 |
|
| 80 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
|
|
|
| 50 |
|
| 51 |
Returns: ip address, city, region, country, and geo coordinates
|
| 52 |
"""
|
| 53 |
+
return {
|
| 54 |
+
'city': response.city,
|
| 55 |
+
'region': response.region,
|
| 56 |
+
'country': response.country,
|
| 57 |
+
'latitude': response.latitude,
|
| 58 |
+
'longitude': response.longitude
|
| 59 |
response = DbIpCity.get(ip, api_key='free')
|
| 60 |
|
| 61 |
|
|
|
|
| 79 |
|
| 80 |
# Get current time in that timezone
|
| 81 |
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 82 |
+
return f"The current local time in {timezone} is: {local_time}"
|
| 83 |
except Exception as e:
|
| 84 |
|
| 85 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|