This is a simple demo which you can use to get IP Address Info using python.
First save IP address in a text file. See the video to understand.
Here is the code:-
For getting specific data use this code:-
Hope you like the tutorial.
Python is simple and fun to play with and yet very powerful. 🔥
First save IP address in a text file. See the video to understand.
Here is the code:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ##JSON URL:- json_url = "http://ip-api.com/json/" import urllib.request as r import json file = open("IP_Address.txt","r") for f in file: response = r.urlopen(json_url+str(f)) data = json.loads(response.read().decode(response.info().get_param('charset') or 'utf-8')) for i in data: print(str(i)+" = \u3018 "+str(data[i])+" \u3019 ") print("---------------------") |
For getting specific data use this code:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ##JSON URL:- json_url = "http://ip-api.com/json/" import urllib.request as r import json file = open("IP_Address.txt","r") for f in file: response = r.urlopen(json_url+str(f)) data = json.loads(response.read().decode(response.info().get_param('charset') or 'utf-8')) print(str("IP Address")+" = \u3018 "+str(data["query"])+" \u3019 ") print(str("country")+" = \u3018 "+str(data["country"])+" \u3019 ") print(str("zip")+" = \u3018 "+str(data["zip"])+" \u3019 ") print("---------------------") |
Hope you like the tutorial.
Python is simple and fun to play with and yet very powerful. 🔥