ipspot 0.6__tar.gz → 0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ipspot-0.6 → ipspot-0.8}/CHANGELOG.md +22 -1
- {ipspot-0.6 → ipspot-0.8}/PKG-INFO +47 -25
- {ipspot-0.6 → ipspot-0.8}/README.md +20 -20
- {ipspot-0.6 → ipspot-0.8}/SECURITY.md +2 -2
- {ipspot-0.6 → ipspot-0.8}/ipspot/cli.py +24 -15
- {ipspot-0.6 → ipspot-0.8}/ipspot/ipv4.py +99 -28
- {ipspot-0.6 → ipspot-0.8}/ipspot/ipv6.py +93 -22
- {ipspot-0.6 → ipspot-0.8}/ipspot/params.py +13 -4
- {ipspot-0.6 → ipspot-0.8}/ipspot/utils.py +7 -2
- {ipspot-0.6 → ipspot-0.8}/ipspot.egg-info/PKG-INFO +47 -25
- {ipspot-0.6 → ipspot-0.8}/setup.py +8 -7
- {ipspot-0.6 → ipspot-0.8}/tests/test_ipv4_api.py +31 -15
- {ipspot-0.6 → ipspot-0.8}/tests/test_ipv4_functions.py +12 -51
- {ipspot-0.6 → ipspot-0.8}/tests/test_ipv6_api.py +27 -11
- {ipspot-0.6 → ipspot-0.8}/tests/test_utils.py +6 -6
- {ipspot-0.6 → ipspot-0.8}/AUTHORS.md +0 -0
- {ipspot-0.6 → ipspot-0.8}/LICENSE +0 -0
- {ipspot-0.6 → ipspot-0.8}/MANIFEST.in +0 -0
- {ipspot-0.6 → ipspot-0.8}/dev-requirements.txt +0 -0
- {ipspot-0.6 → ipspot-0.8}/ipspot/__init__.py +0 -0
- {ipspot-0.6 → ipspot-0.8}/ipspot/__main__.py +0 -0
- {ipspot-0.6 → ipspot-0.8}/ipspot.egg-info/SOURCES.txt +0 -0
- {ipspot-0.6 → ipspot-0.8}/ipspot.egg-info/dependency_links.txt +0 -0
- {ipspot-0.6 → ipspot-0.8}/ipspot.egg-info/entry_points.txt +0 -0
- {ipspot-0.6 → ipspot-0.8}/ipspot.egg-info/requires.txt +0 -0
- {ipspot-0.6 → ipspot-0.8}/ipspot.egg-info/top_level.txt +0 -0
- {ipspot-0.6 → ipspot-0.8}/requirements.txt +0 -0
- {ipspot-0.6 → ipspot-0.8}/setup.cfg +0 -0
- {ipspot-0.6 → ipspot-0.8}/tests/test_ipv6_functions.py +0 -0
|
@@ -5,6 +5,25 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
|
+
## [0.8] - 2026-02-05
|
|
9
|
+
### Added
|
|
10
|
+
- Support [wtfismyip.com](https://wtfismyip.com/json) IPv6 API
|
|
11
|
+
- Support [myip.wtf](https://myip.wtf/) IPv6 API
|
|
12
|
+
- Support [myip.wtf](https://myip.wtf/) IPv4 API
|
|
13
|
+
- Support [db-ip.com](https://api.db-ip.com/v2/free/self) IPv4 API
|
|
14
|
+
### Changed
|
|
15
|
+
- `README.md` updated
|
|
16
|
+
## [0.7] - 2025-12-09
|
|
17
|
+
### Added
|
|
18
|
+
- `--backoff-factor` argument
|
|
19
|
+
### Changed
|
|
20
|
+
- CLI messages updated
|
|
21
|
+
- `Python 3.14` added to `test.yml`
|
|
22
|
+
- Internal functions default values removed
|
|
23
|
+
- `README.md` updated
|
|
24
|
+
- Test system modified
|
|
25
|
+
- `ipspot_info` function renamed to `_print_ipspot_info`
|
|
26
|
+
- `display_ip_info` function renamed to `_print_report`
|
|
8
27
|
## [0.6] - 2025-11-18
|
|
9
28
|
### Added
|
|
10
29
|
- `ForceIPHTTPAdapter` class
|
|
@@ -97,7 +116,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
97
116
|
- `--no-geo` argument
|
|
98
117
|
- Logo
|
|
99
118
|
|
|
100
|
-
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.
|
|
119
|
+
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.8...dev
|
|
120
|
+
[0.8]: https://github.com/openscilab/ipspot/compare/v0.7...v0.8
|
|
121
|
+
[0.7]: https://github.com/openscilab/ipspot/compare/v0.6...v0.7
|
|
101
122
|
[0.6]: https://github.com/openscilab/ipspot/compare/v0.5...v0.6
|
|
102
123
|
[0.5]: https://github.com/openscilab/ipspot/compare/v0.4...v0.5
|
|
103
124
|
[0.4]: https://github.com/openscilab/ipspot/compare/v0.3...v0.4
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ipspot
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: IPSpot:
|
|
3
|
+
Version: 0.8
|
|
4
|
+
Summary: IPSpot: Retrieve IPv4/IPv6 Addresses with Geolocation Data
|
|
5
5
|
Home-page: https://github.com/openscilab/ipspot
|
|
6
|
-
Download-URL: https://github.com/openscilab/ipspot/tarball/v0.
|
|
6
|
+
Download-URL: https://github.com/openscilab/ipspot/tarball/v0.8
|
|
7
7
|
Author: IPSpot Development Team
|
|
8
8
|
Author-email: ipspot@openscilab.com
|
|
9
9
|
License: MIT
|
|
10
10
|
Project-URL: Source, https://github.com/openscilab/ipspot
|
|
11
|
-
Keywords: ip ipv4 geo geolocation network location ipspot cli
|
|
11
|
+
Keywords: ip ipv4 ipv6 geo geolocation network location ipspot cli
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Natural Language :: English
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
24
|
Classifier: Intended Audience :: Developers
|
|
24
25
|
Classifier: Intended Audience :: Education
|
|
25
26
|
Classifier: Intended Audience :: End Users/Desktop
|
|
@@ -50,7 +51,7 @@ Dynamic: summary
|
|
|
50
51
|
|
|
51
52
|
<div align="center">
|
|
52
53
|
<img src="https://github.com/openscilab/ipspot/raw/main/otherfiles/logo.png" width="350">
|
|
53
|
-
<h1>IPSpot:
|
|
54
|
+
<h1>IPSpot: Retrieve IPv4/IPv6 Addresses with Geolocation Data</h1>
|
|
54
55
|
<br/>
|
|
55
56
|
<a href="https://codecov.io/gh/openscilab/ipspot"><img src="https://codecov.io/gh/openscilab/ipspot/graph/badge.svg?token=XCFKASULS8"></a>
|
|
56
57
|
<a href="https://badge.fury.io/py/ipspot"><img src="https://badge.fury.io/py/ipspot.svg" alt="PyPI version"></a>
|
|
@@ -62,7 +63,7 @@ Dynamic: summary
|
|
|
62
63
|
## Overview
|
|
63
64
|
|
|
64
65
|
<p align="justify">
|
|
65
|
-
<b>IPSpot</b> is a Python library for retrieving the current system's IP
|
|
66
|
+
<b>IPSpot</b> 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 <b>IPv4</b> and <b>IPv6</b> 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.
|
|
66
67
|
</p>
|
|
67
68
|
|
|
68
69
|
<table>
|
|
@@ -103,13 +104,13 @@ Dynamic: summary
|
|
|
103
104
|
## Installation
|
|
104
105
|
|
|
105
106
|
### Source Code
|
|
106
|
-
- Download [Version 0.
|
|
107
|
+
- Download [Version 0.8](https://github.com/openscilab/ipspot/archive/v0.8.zip) or [Latest Source](https://github.com/openscilab/ipspot/archive/dev.zip)
|
|
107
108
|
- `pip install .`
|
|
108
109
|
|
|
109
110
|
### PyPI
|
|
110
111
|
|
|
111
112
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
112
|
-
- `pip install ipspot==0.
|
|
113
|
+
- `pip install ipspot==0.8`
|
|
113
114
|
|
|
114
115
|
|
|
115
116
|
## Usage
|
|
@@ -124,7 +125,7 @@ Dynamic: summary
|
|
|
124
125
|
{'status': True, 'data': {'ip': 'xx.xx.xx.xx', 'api': 'ip-api.com'}}
|
|
125
126
|
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10)
|
|
126
127
|
{'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}
|
|
127
|
-
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10, max_retries=5, retry_delay=4)
|
|
128
|
+
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10, max_retries=5, retry_delay=4, backoff_factor=1.2)
|
|
128
129
|
{'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}
|
|
129
130
|
```
|
|
130
131
|
|
|
@@ -144,7 +145,7 @@ Dynamic: summary
|
|
|
144
145
|
{'data': {'api': 'ip.sb', 'ip': 'xx:xx:xx:xx::xx'}, 'status': True}
|
|
145
146
|
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10)
|
|
146
147
|
{'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}
|
|
147
|
-
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10, max_retries=5, retry_delay=4)
|
|
148
|
+
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10, max_retries=5, retry_delay=4, backoff_factor=1.2)
|
|
148
149
|
{'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}
|
|
149
150
|
```
|
|
150
151
|
|
|
@@ -165,7 +166,7 @@ Dynamic: summary
|
|
|
165
166
|
```console
|
|
166
167
|
> ipspot --version
|
|
167
168
|
|
|
168
|
-
0.
|
|
169
|
+
0.8
|
|
169
170
|
```
|
|
170
171
|
|
|
171
172
|
#### Info
|
|
@@ -173,24 +174,24 @@ Dynamic: summary
|
|
|
173
174
|
```console
|
|
174
175
|
> ipspot --info
|
|
175
176
|
|
|
176
|
-
___ ____ ____ _
|
|
177
|
-
|_ _|| _ \ / ___| _ __ ___ | |_
|
|
177
|
+
___ ____ ____ _
|
|
178
|
+
|_ _|| _ \ / ___| _ __ ___ | |_
|
|
178
179
|
| | | |_) |\___ \ | '_ \ / _ \ | __|
|
|
179
|
-
| | | __/ ___) || |_) || (_) || |_
|
|
180
|
+
| | | __/ ___) || |_) || (_) || |_
|
|
180
181
|
|___||_| |____/ | .__/ \___/ \__|
|
|
181
|
-
|_|
|
|
182
|
+
|_|
|
|
182
183
|
|
|
183
|
-
__ __ ___
|
|
184
|
-
\ \ / / _ / _ \
|
|
185
|
-
\ \ / / (_)| | | |
|
|
184
|
+
__ __ ___ ___
|
|
185
|
+
\ \ / / _ / _ \ ( _ )
|
|
186
|
+
\ \ / / (_)| | | | / _ \
|
|
186
187
|
\ V / _ | |_| | _ | (_) |
|
|
187
|
-
\_/ (_) \___/ (_) \___/
|
|
188
|
+
\_/ (_) \___/ (_) \___/
|
|
188
189
|
|
|
189
190
|
|
|
190
191
|
|
|
191
|
-
IPSpot is a Python library for retrieving the current system's IP
|
|
192
|
-
It
|
|
193
|
-
|
|
192
|
+
IPSpot is a Python library for retrieving the current system's IP data and detailed location information such as region, longitude, and latitude.
|
|
193
|
+
It supports both public and private IPv4 and IPv6 detection through multiple API providers, using a fallback mechanism for improved reliability.
|
|
194
|
+
It has a simple and modular design, making it easy to perform fast IP, geolocation, provider, and regional lookups directly from your machine.
|
|
194
195
|
|
|
195
196
|
Repo : https://github.com/openscilab/ipspot
|
|
196
197
|
|
|
@@ -237,7 +238,7 @@ Public IP and Location Info:
|
|
|
237
238
|
|
|
238
239
|
#### IPv4 API
|
|
239
240
|
|
|
240
|
-
ℹ️ `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`]
|
|
241
|
+
ℹ️ `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`]
|
|
241
242
|
|
|
242
243
|
ℹ️ The default value: `auto-safe`
|
|
243
244
|
|
|
@@ -280,7 +281,7 @@ Public IP and Location Info:
|
|
|
280
281
|
|
|
281
282
|
#### IPv6 API
|
|
282
283
|
|
|
283
|
-
ℹ️ `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`]
|
|
284
|
+
ℹ️ `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`]
|
|
284
285
|
|
|
285
286
|
ℹ️ The default value: `auto-safe`
|
|
286
287
|
|
|
@@ -376,6 +377,25 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
376
377
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
377
378
|
|
|
378
379
|
## [Unreleased]
|
|
380
|
+
## [0.8] - 2026-02-05
|
|
381
|
+
### Added
|
|
382
|
+
- Support [wtfismyip.com](https://wtfismyip.com/json) IPv6 API
|
|
383
|
+
- Support [myip.wtf](https://myip.wtf/) IPv6 API
|
|
384
|
+
- Support [myip.wtf](https://myip.wtf/) IPv4 API
|
|
385
|
+
- Support [db-ip.com](https://api.db-ip.com/v2/free/self) IPv4 API
|
|
386
|
+
### Changed
|
|
387
|
+
- `README.md` updated
|
|
388
|
+
## [0.7] - 2025-12-09
|
|
389
|
+
### Added
|
|
390
|
+
- `--backoff-factor` argument
|
|
391
|
+
### Changed
|
|
392
|
+
- CLI messages updated
|
|
393
|
+
- `Python 3.14` added to `test.yml`
|
|
394
|
+
- Internal functions default values removed
|
|
395
|
+
- `README.md` updated
|
|
396
|
+
- Test system modified
|
|
397
|
+
- `ipspot_info` function renamed to `_print_ipspot_info`
|
|
398
|
+
- `display_ip_info` function renamed to `_print_report`
|
|
379
399
|
## [0.6] - 2025-11-18
|
|
380
400
|
### Added
|
|
381
401
|
- `ForceIPHTTPAdapter` class
|
|
@@ -468,7 +488,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
468
488
|
- `--no-geo` argument
|
|
469
489
|
- Logo
|
|
470
490
|
|
|
471
|
-
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.
|
|
491
|
+
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.8...dev
|
|
492
|
+
[0.8]: https://github.com/openscilab/ipspot/compare/v0.7...v0.8
|
|
493
|
+
[0.7]: https://github.com/openscilab/ipspot/compare/v0.6...v0.7
|
|
472
494
|
[0.6]: https://github.com/openscilab/ipspot/compare/v0.5...v0.6
|
|
473
495
|
[0.5]: https://github.com/openscilab/ipspot/compare/v0.4...v0.5
|
|
474
496
|
[0.4]: https://github.com/openscilab/ipspot/compare/v0.3...v0.4
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<img src="https://github.com/openscilab/ipspot/raw/main/otherfiles/logo.png" width="350">
|
|
3
|
-
<h1>IPSpot:
|
|
3
|
+
<h1>IPSpot: Retrieve IPv4/IPv6 Addresses with Geolocation Data</h1>
|
|
4
4
|
<br/>
|
|
5
5
|
<a href="https://codecov.io/gh/openscilab/ipspot"><img src="https://codecov.io/gh/openscilab/ipspot/graph/badge.svg?token=XCFKASULS8"></a>
|
|
6
6
|
<a href="https://badge.fury.io/py/ipspot"><img src="https://badge.fury.io/py/ipspot.svg" alt="PyPI version"></a>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
## Overview
|
|
13
13
|
|
|
14
14
|
<p align="justify">
|
|
15
|
-
<b>IPSpot</b> is a Python library for retrieving the current system's IP
|
|
15
|
+
<b>IPSpot</b> 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 <b>IPv4</b> and <b>IPv6</b> 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.
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
<table>
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
## Installation
|
|
54
54
|
|
|
55
55
|
### Source Code
|
|
56
|
-
- Download [Version 0.
|
|
56
|
+
- Download [Version 0.8](https://github.com/openscilab/ipspot/archive/v0.8.zip) or [Latest Source](https://github.com/openscilab/ipspot/archive/dev.zip)
|
|
57
57
|
- `pip install .`
|
|
58
58
|
|
|
59
59
|
### PyPI
|
|
60
60
|
|
|
61
61
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
62
|
-
- `pip install ipspot==0.
|
|
62
|
+
- `pip install ipspot==0.8`
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
## Usage
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
{'status': True, 'data': {'ip': 'xx.xx.xx.xx', 'api': 'ip-api.com'}}
|
|
75
75
|
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10)
|
|
76
76
|
{'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}
|
|
77
|
-
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10, max_retries=5, retry_delay=4)
|
|
77
|
+
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10, max_retries=5, retry_delay=4, backoff_factor=1.2)
|
|
78
78
|
{'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}
|
|
79
79
|
```
|
|
80
80
|
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
{'data': {'api': 'ip.sb', 'ip': 'xx:xx:xx:xx::xx'}, 'status': True}
|
|
95
95
|
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10)
|
|
96
96
|
{'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}
|
|
97
|
-
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10, max_retries=5, retry_delay=4)
|
|
97
|
+
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10, max_retries=5, retry_delay=4, backoff_factor=1.2)
|
|
98
98
|
{'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}
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
```console
|
|
116
116
|
> ipspot --version
|
|
117
117
|
|
|
118
|
-
0.
|
|
118
|
+
0.8
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
#### Info
|
|
@@ -123,24 +123,24 @@
|
|
|
123
123
|
```console
|
|
124
124
|
> ipspot --info
|
|
125
125
|
|
|
126
|
-
___ ____ ____ _
|
|
127
|
-
|_ _|| _ \ / ___| _ __ ___ | |_
|
|
126
|
+
___ ____ ____ _
|
|
127
|
+
|_ _|| _ \ / ___| _ __ ___ | |_
|
|
128
128
|
| | | |_) |\___ \ | '_ \ / _ \ | __|
|
|
129
|
-
| | | __/ ___) || |_) || (_) || |_
|
|
129
|
+
| | | __/ ___) || |_) || (_) || |_
|
|
130
130
|
|___||_| |____/ | .__/ \___/ \__|
|
|
131
|
-
|_|
|
|
131
|
+
|_|
|
|
132
132
|
|
|
133
|
-
__ __ ___
|
|
134
|
-
\ \ / / _ / _ \
|
|
135
|
-
\ \ / / (_)| | | |
|
|
133
|
+
__ __ ___ ___
|
|
134
|
+
\ \ / / _ / _ \ ( _ )
|
|
135
|
+
\ \ / / (_)| | | | / _ \
|
|
136
136
|
\ V / _ | |_| | _ | (_) |
|
|
137
|
-
\_/ (_) \___/ (_) \___/
|
|
137
|
+
\_/ (_) \___/ (_) \___/
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
IPSpot is a Python library for retrieving the current system's IP
|
|
142
|
-
It
|
|
143
|
-
|
|
141
|
+
IPSpot is a Python library for retrieving the current system's IP data and detailed location information such as region, longitude, and latitude.
|
|
142
|
+
It supports both public and private IPv4 and IPv6 detection through multiple API providers, using a fallback mechanism for improved reliability.
|
|
143
|
+
It has a simple and modular design, making it easy to perform fast IP, geolocation, provider, and regional lookups directly from your machine.
|
|
144
144
|
|
|
145
145
|
Repo : https://github.com/openscilab/ipspot
|
|
146
146
|
|
|
@@ -187,7 +187,7 @@ Public IP and Location Info:
|
|
|
187
187
|
|
|
188
188
|
#### IPv4 API
|
|
189
189
|
|
|
190
|
-
ℹ️ `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`]
|
|
190
|
+
ℹ️ `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`]
|
|
191
191
|
|
|
192
192
|
ℹ️ The default value: `auto-safe`
|
|
193
193
|
|
|
@@ -230,7 +230,7 @@ Public IP and Location Info:
|
|
|
230
230
|
|
|
231
231
|
#### IPv6 API
|
|
232
232
|
|
|
233
|
-
ℹ️ `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`]
|
|
233
|
+
ℹ️ `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`]
|
|
234
234
|
|
|
235
235
|
ℹ️ The default value: `auto-safe`
|
|
236
236
|
|
|
@@ -8,9 +8,11 @@ from .ipv6 import get_public_ipv6, get_private_ipv6
|
|
|
8
8
|
from .utils import _filter_parameter
|
|
9
9
|
from .params import IPv4API, IPv6API, PARAMETERS_NAME_MAP
|
|
10
10
|
from .params import IPSPOT_OVERVIEW, IPSPOT_REPO, IPSPOT_VERSION
|
|
11
|
+
from .params import PUBLIC_IPV4_ERROR, PRIVATE_IPV4_ERROR
|
|
12
|
+
from .params import PUBLIC_IPV6_ERROR, PRIVATE_IPV6_ERROR
|
|
11
13
|
|
|
12
14
|
|
|
13
|
-
def
|
|
15
|
+
def _print_ipspot_info() -> None: # pragma: no cover
|
|
14
16
|
"""Print ipspot details."""
|
|
15
17
|
tprint("IPSpot")
|
|
16
18
|
tprint("V:" + IPSPOT_VERSION)
|
|
@@ -18,11 +20,13 @@ def ipspot_info() -> None: # pragma: no cover
|
|
|
18
20
|
print("Repo : " + IPSPOT_REPO)
|
|
19
21
|
|
|
20
22
|
|
|
21
|
-
def
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
def _print_report(ipv4_api: IPv4API,
|
|
24
|
+
ipv6_api: IPv6API,
|
|
25
|
+
geo: bool,
|
|
26
|
+
timeout: Union[float, Tuple[float, float]],
|
|
27
|
+
max_retries: int,
|
|
28
|
+
retry_delay: float,
|
|
29
|
+
backoff_factor: float) -> None: # pragma: no cover
|
|
26
30
|
"""
|
|
27
31
|
Print collected IP and location data.
|
|
28
32
|
|
|
@@ -32,20 +36,21 @@ def display_ip_info(ipv4_api: IPv4API = IPv4API.AUTO_SAFE,
|
|
|
32
36
|
:param timeout: timeout value for API
|
|
33
37
|
:param max_retries: number of retries
|
|
34
38
|
:param retry_delay: delay between retries (in seconds)
|
|
39
|
+
:param backoff_factor: backoff factor
|
|
35
40
|
"""
|
|
36
41
|
print("Private IP:\n")
|
|
37
42
|
private_ipv4_result = get_private_ipv4()
|
|
38
43
|
if private_ipv4_result["status"]:
|
|
39
44
|
private_ipv4 = private_ipv4_result["data"]["ip"]
|
|
40
45
|
else:
|
|
41
|
-
private_ipv4 =
|
|
46
|
+
private_ipv4 = PRIVATE_IPV4_ERROR
|
|
42
47
|
print(" IPv4: {private_ipv4}\n".format(private_ipv4=private_ipv4))
|
|
43
48
|
|
|
44
49
|
private_ipv6_result = get_private_ipv6()
|
|
45
50
|
if private_ipv6_result["status"]:
|
|
46
51
|
private_ipv6 = private_ipv6_result["data"]["ip"]
|
|
47
52
|
else:
|
|
48
|
-
private_ipv6 =
|
|
53
|
+
private_ipv6 = PRIVATE_IPV6_ERROR
|
|
49
54
|
print(" IPv6: {private_ipv6}".format(private_ipv6=private_ipv6))
|
|
50
55
|
|
|
51
56
|
public_title = "\nPublic IP"
|
|
@@ -59,7 +64,8 @@ def display_ip_info(ipv4_api: IPv4API = IPv4API.AUTO_SAFE,
|
|
|
59
64
|
geo=geo,
|
|
60
65
|
timeout=timeout,
|
|
61
66
|
max_retries=max_retries,
|
|
62
|
-
retry_delay=retry_delay
|
|
67
|
+
retry_delay=retry_delay,
|
|
68
|
+
backoff_factor=backoff_factor)
|
|
63
69
|
if public_ipv4_result["status"]:
|
|
64
70
|
for name, parameter in sorted(public_ipv4_result["data"].items()):
|
|
65
71
|
print(
|
|
@@ -67,7 +73,7 @@ def display_ip_info(ipv4_api: IPv4API = IPv4API.AUTO_SAFE,
|
|
|
67
73
|
name=PARAMETERS_NAME_MAP[name],
|
|
68
74
|
parameter=_filter_parameter(parameter)))
|
|
69
75
|
else:
|
|
70
|
-
print(" Error: {public_ipv4_result
|
|
76
|
+
print(" Error: {public_ipv4_result}".format(public_ipv4_result=PUBLIC_IPV4_ERROR))
|
|
71
77
|
|
|
72
78
|
print("\n IPv6:\n")
|
|
73
79
|
public_ipv6_result = get_public_ipv6(
|
|
@@ -75,7 +81,8 @@ def display_ip_info(ipv4_api: IPv4API = IPv4API.AUTO_SAFE,
|
|
|
75
81
|
geo=geo,
|
|
76
82
|
timeout=timeout,
|
|
77
83
|
max_retries=max_retries,
|
|
78
|
-
retry_delay=retry_delay
|
|
84
|
+
retry_delay=retry_delay,
|
|
85
|
+
backoff_factor=backoff_factor)
|
|
79
86
|
if public_ipv6_result["status"]:
|
|
80
87
|
for name, parameter in sorted(public_ipv6_result["data"].items()):
|
|
81
88
|
print(
|
|
@@ -83,7 +90,7 @@ def display_ip_info(ipv4_api: IPv4API = IPv4API.AUTO_SAFE,
|
|
|
83
90
|
name=PARAMETERS_NAME_MAP[name],
|
|
84
91
|
parameter=_filter_parameter(parameter)))
|
|
85
92
|
else:
|
|
86
|
-
print(" Error: {public_ipv6_result
|
|
93
|
+
print(" Error: {public_ipv6_result}".format(public_ipv6_result=PUBLIC_IPV6_ERROR))
|
|
87
94
|
|
|
88
95
|
|
|
89
96
|
def main() -> None: # pragma: no cover
|
|
@@ -109,20 +116,22 @@ def main() -> None: # pragma: no cover
|
|
|
109
116
|
parser.add_argument('--timeout', help='timeout for the API request', type=float, default=5.0)
|
|
110
117
|
parser.add_argument('--max-retries', help='number of retries', type=int, default=0)
|
|
111
118
|
parser.add_argument('--retry-delay', help='delay between retries (in seconds)', type=float, default=1.0)
|
|
119
|
+
parser.add_argument('--backoff-factor', help='backoff factor', type=float, default=1.0)
|
|
112
120
|
|
|
113
121
|
args = parser.parse_args()
|
|
114
122
|
if args.version:
|
|
115
123
|
print(IPSPOT_VERSION)
|
|
116
124
|
elif args.info:
|
|
117
|
-
|
|
125
|
+
_print_ipspot_info()
|
|
118
126
|
else:
|
|
119
127
|
ipv4_api = IPv4API(args.ipv4_api)
|
|
120
128
|
ipv6_api = IPv6API(args.ipv6_api)
|
|
121
129
|
geo = not args.no_geo
|
|
122
|
-
|
|
130
|
+
_print_report(
|
|
123
131
|
ipv4_api=ipv4_api,
|
|
124
132
|
ipv6_api=ipv6_api,
|
|
125
133
|
geo=geo,
|
|
126
134
|
timeout=args.timeout,
|
|
127
135
|
max_retries=args.max_retries,
|
|
128
|
-
retry_delay=args.retry_delay
|
|
136
|
+
retry_delay=args.retry_delay,
|
|
137
|
+
backoff_factor=args.backoff_factor)
|