Skip to main content

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

Project description

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


PyPI version built with Python3 GitHub repo size Discord Channel

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
Code Quality CodeFactor

Installation

Source Code

PyPI

Usage

Library

Public IPv4

>>> from ipspot import get_public_ipv4, IPv4API
>>> get_public_ipv4(api=IPv4API.IP_API_COM)
{'status': True, 'data': {'ip': 'xx.xx.xx.xx', 'api': 'ip-api.com'}}
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10)
{'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}
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10, max_retries=5, retry_delay=4)
{'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.4

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-safe, auto, ip-api.com, ipinfo.io, ip.sb, ident.me, tnedi.me, ipapi.co, ipleak.net, my-ip.io, ifconfig.co, reallyfreegeoip.org, freeipapi.com, myip.la]

ℹ️ The default value: auto-safe

> ipspot --ipv4-api="ipinfo.io"
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

You can also join our discord server

Discord Channel

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

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

0.4 - 2025-06-09

Added

Changed

  • IPv4API.IPAPI renamed to IPv4API.IP_API_COM
  • IPv4API.IPINFO renamed to IPv4API.IPINFO_IO
  • IPv4API.IPSB renamed to IPv4API.IP_SB
  • IPv4API.IDENTME renamed to IPv4API.IDENT_ME
  • IPv4API.TNEDIME renamed to IPv4API.TNEDI_ME
  • get_public_ipv4 function modified
  • filter_parameter function renamed to _filter_parameter
  • README.md updated

0.3 - 2025-05-19

Added

  • is_ipv4 function
  • is_loopback function
  • IPv4HTTPAdapter class
  • Support ident.me
  • Support tnedi.me

Changed

  • get_private_ipv4 function modified
  • get_public_ipv4 function modified
  • _ipsb_ipv4 function modified
  • _ipapi_ipv4 function modified
  • _ipinfo_ipv4 function modified
  • functions.py renamed to utils.py
  • CLI functions moved to cli.py
  • IPv4 functions moved to ipv4.py
  • Test system modified

0.2 - 2025-05-04

Added

  • Support ip.sb
  • --timeout argument

Changed

  • README.md updated
  • Requests header updated
  • Test system modified

0.1 - 2025-04-25

Added

  • Support ipinfo.io
  • Support ip-api.com
  • get_private_ipv4 function
  • get_public_ipv4 function
  • --info and --version arguments
  • --ipv4-api argument
  • --no-geo argument
  • Logo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipspot-0.4.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipspot-0.4-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file ipspot-0.4.tar.gz.

File metadata

  • Download URL: ipspot-0.4.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ipspot-0.4.tar.gz
Algorithm Hash digest
SHA256 d2369b3ba9ad8cecb0015e1fb4b48960d5a290c81540f33487fd545752596d93
MD5 5ea1ae801865ec4f6e453022eea70187
BLAKE2b-256 fdc9e00f0a2d2f190d17ef428fdce9b53fb3a76360410fc055954dac6c32f10a

See more details on using hashes here.

File details

Details for the file ipspot-0.4-py3-none-any.whl.

File metadata

  • Download URL: ipspot-0.4-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ipspot-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 20b23874828864f4abfea22fdcbb68432c71ad45a3afacaec7b182fb8b5b373a
MD5 ab176a22f4677c3b07555c84d724687b
BLAKE2b-256 f9d3f438223c0831016a5a0dcd403f3a689c9fc9a8c5093d6ebe80de1c63864d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page