-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIpGeoLocator.py
More file actions
21 lines (18 loc) · 778 Bytes
/
IpGeoLocator.py
File metadata and controls
21 lines (18 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import requests
import json
while True:
ip_address = input("Ip Address to trace: ")
request = requests.get(f"https://ipinfo.io/{ip_address}/json")
match request.status_code:
case 200:
request_json = json.loads(request.content)
print(f"City: {request_json['city']}")
print(f"Region: {request_json['region']}")
print(f"Country: {request_json['country']}")
print(f"Location: {request_json['loc']}")
print(f"Timezone: {request_json['timezone']}")
print(f"ASN: {request_json['org']}")
print(f"Google Maps: https://google.com/maps/?q={request_json['loc']}")
case _:
print("[Error] Could not get Ip Information")
continue