-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathip_find.py
More file actions
26 lines (21 loc) · 783 Bytes
/
ip_find.py
File metadata and controls
26 lines (21 loc) · 783 Bytes
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
import requests
# Specify the IP address
ip = "{Enter_the_ip}"
# Make a GET request to the ipinfo.io API with the IP address you entered
response = requests.get(f"https://ipinfo.io/{ip}/json")
data = response.json()
# Getting relevant information
location = {
"IP": data.get("ip"),
"City": data.get("city"),
"Region": data.get("region"),
"Country": data.get("country"),
"Latitude and Longitude": data.get("loc"),
"Organization": data.get("org"),
}
print(f"- IP: {location['IP']}")
print(f"- City: {location['City']}")
print(f"- Region: {location['Region']}")
print(f"- Country: {location['Country']}")
print(f"- Latitude and Longitude: {location['Latitude and Longitude']}")
print(f"- Organization: {location['Organization']}")