landmarks / utils.py
Vishwas1's picture
Upload 5 files
ed11779 verified
import requests
def get_current_location():
"""Get the user's current location using an IP geolocation API."""
try:
response = requests.get("https://ipapi.co/json/")
data = response.json()
return data["latitude"], data["longitude"]
except:
# Default to a fixed location if geolocation fails
return 40.7128, -74.0060 # New York City coordinates