-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.py
More file actions
24 lines (16 loc) · 675 Bytes
/
view.py
File metadata and controls
24 lines (16 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import requests
import webbrowser
def view_location_on_maps(phone_number):
url = f'http://127.0.0.1:5000/view_location/{phone_number}'
response = requests.get(url)
if response.status_code == 200:
location = response.json()
latitude = location['latitude']
longitude = location['longitude']
maps_url = f"https://www.google.com/maps?q={latitude},{longitude}"
print(f"Opening location in Google Maps: {maps_url}")
webbrowser.open(maps_url)
else:
print("Location not found for this phone number.")
phone_number = "+94123456789"
view_location_on_maps(phone_number)