-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathmain.py
34 lines (25 loc) · 861 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import phonenumbers
from phonenumbers import geocoder
from phonenumbers import carrier
import opencage
from opencage.geocoder import OpenCageGeocode
import folium
key = "your key" #Geocoder API Key needs to paste here "your key"
number = input("please giver your number: ")
new_number = phonenumbers.parse(number)
location = geocoder.description_for_number(new_number, "en")
print(location)
service_name = carrier.name_for_number(new_number,"en")
print(service_name)
geocoder = OpenCageGeocode(key)
query = str(location)
result = geocoder.geocode(query)
#print(result)
lat = result[0]['geometry']['lat']
lng = result[0]['geometry']['lng']
print(lat,lng)
my_map = folium.Map(location=[lat,lng], zoom_start=9)
folium.Marker([lat, lng], popup= location).add_to(my_map)
my_map.save("location.html")
print("location tracking completed")
print("Thank you")