how to make a ip locator in python

Solutions on MaxInterview for how to make a ip locator in python by the best coders in the world

showing results for - "how to make a ip locator in python"
Moe
22 Jan 2016
1import geocoder
2import folium
3import time
4
5print("")
6ip = input("Type ip here : ")
7geoapi = geocoder.ip(ip)
8
9coords = geoapi.latlng
10provider = geoapi.country
11city = geoapi.city
12my_map1 = folium.Map(Location=coords,
13                    zoom_start=12)
14folium.CircleMarker(location=coords, radius=50, popup="Location").add_to(my_map1)
15folium.Marker(coords, popup="Location").add_to(my_map1)
16my_map1.save("map_export.html ")
17print("")
18print(f"Country : {provider}")
19print(f"City : {city}")
20print(f"Coords : {coords}")
21print("")
22print("Script has generated a .html map in the same folder as this file")
23print("")
24print("")
25print("")
26print("")
27time.sleep(3)
28print("The program will automaticly close in 30 seconds")
29time.sleep(30)
30exit()
31
32
33### BE AWARE! You do need to import the geocoder and folium onto your laptop/pc/device