IPSpot: Retrieve IPv4/IPv6 Addresses with Geolocation Data
Project description
Overview
IPSpot is a Python library for retrieving the current system's IP data and detailed location information such as region, longitude, and latitude. It supports both public and private IPv4 and IPv6 detection through multiple API providers, using a fallback mechanism for improved reliability. It has a simple and modular design, making it easy to perform fast IP, geolocation, provider, and regional lookups directly from your machine.
| PyPI Counter | |
| Github Stars |
| Branch | main | dev |
| CI |
| Code Quality |
Installation
Source Code
- Download Version 0.8 or Latest Source
pip install .
PyPI
- Check Python Packaging User Guide
pip install ipspot==0.8
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, backoff_factor=1.2)
{'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'}}
Public IPv6
>>> from ipspot import get_public_ipv6, IPv6API
>>> get_public_ipv6(api=IPv6API.IP_SB)
{'data': {'api': 'ip.sb', 'ip': 'xx:xx:xx:xx::xx'}, 'status': True}
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10)
{'data': {'latitude': 51.2993, 'region': None, 'city': None, 'country_code': 'DE', 'api': 'ip.sb', 'longitude': 9.491, 'country': 'Germany', 'organization': 'Hetzner Online', 'timezone': 'Europe/Berlin', 'ip': 'xx:xx:xx:xx::xx'}, 'status': True}
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10, max_retries=5, retry_delay=4, backoff_factor=1.2)
{'data': {'latitude': 51.2993, 'region': None, 'city': None, 'country_code': 'DE', 'api': 'ip.sb', 'longitude': 9.491, 'country': 'Germany', 'organization': 'Hetzner Online', 'timezone': 'Europe/Berlin', 'ip': 'xx:xx:xx:xx::xx'}, 'status': True}
Private IPv6
>>> from ipspot import get_private_ipv6
>>> get_private_ipv6()
{'status': True, 'data': {'ip': 'fe80::e1bd:f78:b233:21c9'}}
CLI
ℹ️ You can use ipspot or python -m ipspot to run this program
Version
> ipspot --version
0.8
Info
> ipspot --info
___ ____ ____ _
|_ _|| _ \ / ___| _ __ ___ | |_
| | | |_) |\___ \ | '_ \ / _ \ | __|
| | | __/ ___) || |_) || (_) || |_
|___||_| |____/ | .__/ \___/ \__|
|_|
__ __ ___ ___
\ \ / / _ / _ \ ( _ )
\ \ / / (_)| | | | / _ \
\ V / _ | |_| | _ | (_) |
\_/ (_) \___/ (_) \___/
IPSpot is a Python library for retrieving the current system's IP data and detailed location information such as region, longitude, and latitude.
It supports both public and private IPv4 and IPv6 detection through multiple API providers, using a fallback mechanism for improved reliability.
It has a simple and modular design, making it easy to perform fast IP, geolocation, provider, and regional lookups directly from your machine.
Repo : https://github.com/openscilab/ipspot
Basic
> ipspot
Private IP:
IPv4: 192.168.1.35
IPv6: fe80::e1bd:f78:b233:21c9
Public IP and Location Info:
IPv4:
API: ipinfo.io
City: Nuremberg
Country: Germany
Country Code: DE
IP: xx.xx.xx.xx
Latitude: 49.4527
Longitude: 11.0783
Organization: Hetzner Online GmbH
Region: Bavaria
Timezone: Europe/Berlin
IPv6:
API: ip.sb
City: N/A
Country: Germany
Country Code: DE
IP: xx:xx:xx:xx::xx
Latitude: 51.2993
Longitude: 9.491
Organization: Hetzner Online
Region: N/A
Timezone: Europe/Berlin
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, ipquery.io, ipwho.is, wtfismyip.com, myip.wtf, db-ip.com]
ℹ️ The default value: auto-safe
> ipspot --ipv4-api="ipinfo.io"
Private IP:
IPv4: 192.168.1.35
IPv6: fe80::e1bd:f78:b233:21c9
Public IP and Location Info:
IPv4:
API: ipinfo.io
City: Nuremberg
Country: Germany
Country Code: DE
IP: xx.xx.xx.xx
Latitude: 49.4527
Longitude: 11.0783
Organization: Hetzner Online GmbH
Region: Bavaria
Timezone: Europe/Berlin
IPv6:
API: ip.sb
City: N/A
Country: Germany
Country Code: DE
IP: xx:xx:xx:xx::xx
Latitude: 51.2993
Longitude: 9.491
Organization: Hetzner Online
Region: N/A
Timezone: Europe/Berlin
IPv6 API
ℹ️ ipv6-api valid choices: [auto-safe, auto, ip.sb, ident.me, tnedi.me, ipleak.net, my-ip.io, ifconfig.co, reallyfreegeoip.org, myip.la, freeipapi.com, wtfismyip.com, myip.wtf]
ℹ️ The default value: auto-safe
> ipspot --ipv6-api="ip.sb"
Private IP:
IPv4: 192.168.1.35
IPv6: fe80::e1bd:f78:b233:21c9
Public IP and Location Info:
IPv4:
API: ipinfo.io
City: Nuremberg
Country: Germany
Country Code: DE
IP: xx.xx.xx.xx
Latitude: 49.4527
Longitude: 11.0783
Organization: Hetzner Online GmbH
Region: Bavaria
Timezone: Europe/Berlin
IPv6:
API: ip.sb
City: N/A
Country: Germany
Country Code: DE
IP: xx:xx:xx:xx::xx
Latitude: 51.2993
Longitude: 9.491
Organization: Hetzner Online
Region: N/A
Timezone: Europe/Berlin
No Geolocation
> ipspot --no-geo
Private IP:
IPv4: 192.168.1.35
IPv6: fe80::5c40:769f:22de:c196
Public IP:
IPv4:
API: tnedi.me
IP: xx.xx.xx.xx
IPv6:
API: ip.sb
IP: xx: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.8 - 2026-02-05
Added
- Support wtfismyip.com IPv6 API
- Support myip.wtf IPv6 API
- Support myip.wtf IPv4 API
- Support db-ip.com IPv4 API
Changed
README.mdupdated
0.7 - 2025-12-09
Added
--backoff-factorargument
Changed
- CLI messages updated
Python 3.14added totest.yml- Internal functions default values removed
README.mdupdated- Test system modified
ipspot_infofunction renamed to_print_ipspot_infodisplay_ip_infofunction renamed to_print_report
0.6 - 2025-11-18
Added
ForceIPHTTPAdapterclass_get_json_force_ipfunction- Support ifconfig.co IPv6 API
- Support reallyfreegeoip.org IPv6 API
- Support myip.la IPv6 API
- Support freeipapi.com IPv6 API
Changed
- freeipapi.com IPv4 API bug fixed
README.mdupdated
Removed
IPv4HTTPAdapterclass_get_json_ipv4_forcedfunction
0.5 - 2025-10-17
Added
setup-warpaction- Support ipwho.is
- Support ipquery.io
- Support wtfismyip.com
- Support ident.me IPv6 API
- Support tnedi.me IPv6 API
- Support ip.sb IPv6 API
- Support ipleak.net IPv6 API
- Support my-ip.io IPv6 API
is_ipv6functionget_private_ipv6functionget_public_ipv6functionIPv6APIenum--ipv6-apiargument
Changed
- Test system modified
README.mdupdated
0.4 - 2025-06-09
Added
- Support ipapi.co
- Support ipleak.net
- Support my-ip.io
- Support ifconfig.co
- Support reallyfreegeoip.org
- Support myip.la
- Support freeipapi.com
AUTO_SAFEmode_get_json_standardfunction_get_json_ipv4_forcedfunction--max-retriesargument--retry-delayargument
Changed
IPv4API.IPAPIrenamed toIPv4API.IP_API_COMIPv4API.IPINFOrenamed toIPv4API.IPINFO_IOIPv4API.IPSBrenamed toIPv4API.IP_SBIPv4API.IDENTMErenamed toIPv4API.IDENT_MEIPv4API.TNEDIMErenamed toIPv4API.TNEDI_MEget_public_ipv4function modifiedfilter_parameterfunction renamed to_filter_parameterREADME.mdupdated
0.3 - 2025-05-19
Added
Changed
get_private_ipv4function modifiedget_public_ipv4function modified_ipsb_ipv4function modified_ipapi_ipv4function modified_ipinfo_ipv4function modifiedfunctions.pyrenamed toutils.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
--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.8.tar.gz.
File metadata
- Download URL: ipspot-0.8.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc1be6c9a89a9df2415e2dc393555288c1c2f5211391348820f69834437eed48
|
|
| MD5 |
1293e15f10414082bc60ea8ba30c06f5
|
|
| BLAKE2b-256 |
1cebec486a59e378a442da8bf21821e583acf891d4ff1f29b0878f2023702756
|
File details
Details for the file ipspot-0.8-py3-none-any.whl.
File metadata
- Download URL: ipspot-0.8-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ec55936d0f0f82553af97c725a00db7625b261b0a34d607d74269dda8794e17
|
|
| MD5 |
40ca0dc8c0eb3a225383f82ee2ba95db
|
|
| BLAKE2b-256 |
95626fda9ef9429857b0176c5cd5c7182de68553cfb97f6d3d927f79e84317a0
|