Awesome-Python-Scripts/extended_ip_address_info
2019-10-09 22:59:34 +02:00
..
extended_ip_address_info.py add extended_ip_address_info.py 2019-10-09 22:59:34 +02:00
README.md add extended_ip_address_info.py 2019-10-09 22:59:34 +02:00
requirements.txt add extended_ip_address_info.py 2019-10-09 22:59:34 +02:00

Extended IP address info

View extended info about your public IP address from the terminal.

The python script runs curl with the following parameters

curl -H "Accept: application/json" https://ipinfo.io/json

Create virtual environment and run

Create virtual environment.

python3 -m venv /path/to/new/virtual/environment

Activate virtual environment.

cd <file folder>
source bin/activate

Install required libraries.

pip install -r requirements.txt

Run program.

python extended_ip_address_info.py

Deactivate virtual environment.

deactivate

Output

Output should be in the form of the following:

{
  "ip": "xxx.xxx.xxx.xxx",
  "city": "A_city",
  "hostname": "host.isp-website.com",
  "region": "A_region",
  "country": "Country code",
  "loc": "coordinates",
  "org": "AS-number ISP-name",
  "postal": "postal-code",
  "timezone": "Europe/City",
  "readme": "https://ipinfo.io/missingauth"
}