Get location from a URL with python

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üye
Katılım
12 Nis 2019
Mesajlar
35
Tepki puanı
13
Ödüller
4
7 HİZMET YILI
Required library:
pip install ip2geotools

Python Code:
Python:
import socket
from ip2geotools.databases.noncommercial import DbIpCity

url = "amazon.com"

IP = socket.gethostbyname(url)
response = DbIpCity.get(IP, api_key='free')

print("IP:", IP)
print("City:", response.city)
print("Region:", response.region)
print("Country:", response.country)

Output:
IP: 54.239.28.85
City: Ashburn
Region: Virginia
Country: US
 
ERROR PROBLEM FIXER
Support
Katılım
25 Eyl 2018
Mesajlar
5,366
Çözümler
1,450
Tepki puanı
2,351
Ödüller
20
Sosyal
7 HİZMET YILI
not hard its easy tutorial thank you man
 
Patrick Bateman
Süper Üye
Katılım
11 Şub 2021
Mesajlar
874
Çözümler
12
Tepki puanı
142
Ödüller
6
Sosyal
5 HİZMET YILI
thanks it works but the longitude and latitude is not correct
 
Onaylı Üye
Katılım
11 May 2022
Mesajlar
52
Tepki puanı
4
Ödüller
2
Yaş
32
4 HİZMET YILI
not sure why this would be helpful in terms of hacking
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...