-
-
Notifications
You must be signed in to change notification settings - Fork 262
/
Copy pathIp-locator.py
54 lines (39 loc) · 1017 Bytes
/
Ip-locator.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#usr/bin/env python
import requests
user_in = input("Enter the ip Address : ")
url_gen = 'http://ip-api.com/json/'+ user_in
print(url_gen)
ip_data = None
try:
ip_data = requests.get(url_gen)
except:
print("Please! Check your internet connection")
if (ip_data != None):
r = requests.get(url_gen)
file = r.json()
country = file['country']
countryCode = file['countryCode']
region = file['region' ]
regionName = file['regionName']
city = file['city']
zip_ = file['zip']
lat = file['lat']
lon = file['lon']
timezone = file['timezone']
isp = file['isp']
org = file['org']
print('''
................_script copyright Karan Sharma_................
country = {0} \n
countryCode = {1} \n
region = {2} \n
regionName = {3}\n
city = {4}\n
zip = {5}\n
lat = {6}\n
lon = {7}\n
timezone = {8}\n
isp = {9}\n
'''.format(country,countryCode,region,regionName,city,zip_,lat,lon,timezone,isp)
)
print(url_gen)