Skip to content

IPSpot: A Python Tool to Fetch the System's IP Address

License

Notifications You must be signed in to change notification settings

openscilab/ipspot

Repository files navigation

IPSpot: A Python Tool to Fetch the System's IP Address


PyPI version built with Python3 GitHub repo size

Overview

IPSpot is a Python library for retrieving the current system's IP address and location information. It currently supports public and private IPv4 detection using multiple API providers with a fallback mechanism for reliability. Designed with simplicity and modularity in mind, IPSpot offers quick IP and geolocation lookups directly from your machine.

PyPI Counter
Github Stars
Branch main dev
CI

Installation

Source Code

PyPI

Usage

Library

Public IPv4

>>> from ipspot import get_public_ipv4, IPv4API
>>> get_public_ipv4(api=IPv4API.IPAPI)
{'status': True, 'data': {'ip': 'xx.xx.xx.xx', 'api': 'ip-api.com'}}
>>> get_public_ipv4(api=IPv4API.IPAPI, geo=True)
{'data': {'country_code': 'GB', 'latitude': 50.9097, 'longitude': -1.4043, 'api': 'ip-api.com', 'country': 'United Kingdom', 'timezone': 'Europe/London', 'organization': '', 'region': 'England', 'ip': 'xx.xx.xx.xx', 'city': 'Southampton'}, 'status': True}

Private IPv4

>>> from ipspot import get_private_ipv4
>>> get_private_ipv4()
{'status': True, 'data': {'ip': '10.36.18.154'}}

CLI

ℹ️ You can use ipspot or python -m ipspot to run this program

Version

> ipspot --version

0.1

Info

> ipspot --info

 ___  ____   ____                 _
|_ _||  _ \ / ___|  _ __    ___  | |_
 | | | |_) |\___ \ | '_ \  / _ \ | __|
 | | |  __/  ___) || |_) || (_) || |_
|___||_|    |____/ | .__/  \___/  \__|
                   |_|

__     __     ___      _
\ \   / / _  / _ \    / |
 \ \ / / (_)| | | |   | |
  \ V /   _ | |_| | _ | |
   \_/   (_) \___/ (_)|_|



IPSpot is a Python library for retrieving the current system's IP address and location information.
It currently supports public and private IPv4 detection using multiple API providers with a fallback mechanism for reliability.
Designed with simplicity and modularity in mind, IPSpot offers quick IP and geolocation lookups directly from your machine.

Repo : https://github.com/openscilab/ipspot

Basic

> ipspot
Private IP:

  10.36.18.154

Public IP and Location Info:

  API: ip-api.com
  City: Southampton
  Country: United Kingdom
  Country Code: GB
  IP: xx.xx.xx.xx
  Latitude: 50.9097
  Longitude: -1.4043
  Organization: N/A
  Region: England
  Timezone: Europe/London

IPv4 API

ℹ️ ipv4-api valid choices: [auto, ipapi, ipinfo]

ℹ️ The default value: auto

> ipspot --ipv4-api="ipinfo"
Private IP:

  10.36.18.154

Public IP and Location Info:

  API: ipinfo.io
  City: Leatherhead
  Country: N/A
  Country Code: GB
  IP: xx.xx.xx.xx
  Latitude: 51.2965
  Longitude: -0.3338
  Organization: AS212238 Datacamp Limited
  Region: England
  Timezone: Europe/London

No Geolocation

> ipspot --no-geo
Private IP:

  IP: 10.36.18.154

Public IP:

  API: ipinfo.io
  IP: xx.xx.xx.xx

Issues & Bug Reports

Just fill an issue and describe it. We'll check it ASAP!

  • Please complete the issue template

Show Your Support

Star This Repo

Give a ⭐️ if this project helped you!

Donate to Our Project

If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-)

IPSpot Donation