Created
December 9, 2018 07:33
-
-
Save afrida67/03addc67398e8179be44ee4ff8179f42 to your computer and use it in GitHub Desktop.
Find geolocation information about an IP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Sample Input | |
63.70.164.200 | |
168.12.13.1 | |
Sample Output | |
Lincoln (Highlands), Nebraska (United States) | |
Atlanta (150), Georgia (United States) | |
''' | |
##install: pip install ipapi | |
import ipapi | |
ip_address = str(input("Enter the IP address\n" )) | |
print("Country : ",ipapi.location(ip_address, None, 'country')) | |
print("City : ",ipapi.location(ip_address, None, 'city')) | |
print("Region : ",ipapi.location(ip_address, None, 'region')) | |
#print(ipapi.location(ip='168.12.13.1', key=None, field=None)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment