-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrackPhonenumber.py
More file actions
32 lines (23 loc) · 887 Bytes
/
TrackPhonenumber.py
File metadata and controls
32 lines (23 loc) · 887 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
25
26
27
28
29
30
31
32
from opencage.geocoder import OpenCageGeocode
import phonenumbers
from phonenumbers import geocoder, carrier
import folium
key = 'xxxxxxxxxxxxx'
# write your desired phone no. in place of xxxx
phoneNUM = phonenumbers.parse("+91xxxxxx")
carrier = carrier.name_for_number(phoneNUM, 'en')
Region = geocoder.description_for_number(phoneNUM, 'en')
print(carrier)
print(Region)
# goto opencage.com and create a account free to get a api key and paste it in key ='xxx'.
geocoder = OpenCageGeocode(key)
query = str(Region)
results = geocoder.geocode(query)
#print(results)
lat = results[0]['geometry']['lat']
lng = results[0]['geometry']['lng']
print(lat, lng)
myMap = folium.Map(location=[lat, lng], zoom_start=9)
folium.Marker([lat, lng], popup=Region).add_to((myMap))
# saves a html file with geolocation of phone number
myMap.save("mylocation.html")