IPSpot: A Python Tool to Fetch the System's IP Address
Project description
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 |
Installation
Source Code
- Download Version 0.2 or Latest Source
pip install .
PyPI
- Check Python Packaging User Guide
pip install ipspot==0.2
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, 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}
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.2
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, ipsb]
ℹ️ 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
You can also join our discord server
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 ;-)
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.2 - 2025-05-04
Added
- Support ip.sb
--timeoutargument
Changed
README.mdupdated- Requests header updated
- Test system modified
0.1 - 2025-04-25
Added
- Support ipinfo.io
- Support ip-api.com
get_private_ipv4functionget_public_ipv4function--infoand--versionarguments--ipv4-apiargument--no-geoargument- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ipspot-0.2.tar.gz.
File metadata
- Download URL: ipspot-0.2.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
826bfaae2a87443a7d5d59bbff2713ee53152b395d9a8aa72c34c4d15f36f4ff
|
|
| MD5 |
b3b1c50376a558aab9d55c99c19d228e
|
|
| BLAKE2b-256 |
779875d1c065256c7172299837dd8dcb3b51c044371da3e41f4e4e4063e1051e
|
File details
Details for the file ipspot-0.2-py3-none-any.whl.
File metadata
- Download URL: ipspot-0.2-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87c474b03a99aa74674ffdb039e3258ef86bec8f812feaf14b8c3072ffcb5405
|
|
| MD5 |
a4102c99936753be7f482bdbb5f5b350
|
|
| BLAKE2b-256 |
111b56e2b32bb081bff633fa4562a79a8f6291b964dfc70f82532de86788ecb2
|