ipspot 0.5__tar.gz → 0.7__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.5 → ipspot-0.7}/CHANGELOG.md +28 -1
- {ipspot-0.5 → ipspot-0.7}/PKG-INFO +73 -29
- {ipspot-0.5 → ipspot-0.7}/README.md +41 -25
- {ipspot-0.5 → ipspot-0.7}/SECURITY.md +2 -2
- {ipspot-0.5 → ipspot-0.7}/ipspot/cli.py +24 -15
- {ipspot-0.5 → ipspot-0.7}/ipspot/ipv4.py +46 -100
- {ipspot-0.5 → ipspot-0.7}/ipspot/ipv6.py +152 -12
- {ipspot-0.5 → ipspot-0.7}/ipspot/params.py +10 -1
- ipspot-0.7/ipspot/utils.py +137 -0
- {ipspot-0.5 → ipspot-0.7}/ipspot.egg-info/PKG-INFO +73 -29
- {ipspot-0.5 → ipspot-0.7}/setup.py +4 -3
- {ipspot-0.5 → ipspot-0.7}/tests/test_ipv4_api.py +16 -16
- {ipspot-0.5 → ipspot-0.7}/tests/test_ipv6_api.py +38 -6
- {ipspot-0.5 → ipspot-0.7}/tests/test_utils.py +6 -6
- ipspot-0.5/ipspot/utils.py +0 -69
- {ipspot-0.5 → ipspot-0.7}/AUTHORS.md +0 -0
- {ipspot-0.5 → ipspot-0.7}/LICENSE +0 -0
- {ipspot-0.5 → ipspot-0.7}/MANIFEST.in +0 -0
- {ipspot-0.5 → ipspot-0.7}/dev-requirements.txt +0 -0
- {ipspot-0.5 → ipspot-0.7}/ipspot/__init__.py +0 -0
- {ipspot-0.5 → ipspot-0.7}/ipspot/__main__.py +0 -0
- {ipspot-0.5 → ipspot-0.7}/ipspot.egg-info/SOURCES.txt +0 -0
- {ipspot-0.5 → ipspot-0.7}/ipspot.egg-info/dependency_links.txt +0 -0
- {ipspot-0.5 → ipspot-0.7}/ipspot.egg-info/entry_points.txt +0 -0
- {ipspot-0.5 → ipspot-0.7}/ipspot.egg-info/requires.txt +0 -0
- {ipspot-0.5 → ipspot-0.7}/ipspot.egg-info/top_level.txt +0 -0
- {ipspot-0.5 → ipspot-0.7}/requirements.txt +0 -0
- {ipspot-0.5 → ipspot-0.7}/setup.cfg +0 -0
- {ipspot-0.5 → ipspot-0.7}/tests/test_ipv4_functions.py +0 -0
- {ipspot-0.5 → ipspot-0.7}/tests/test_ipv6_functions.py +0 -0
|
@@ -5,6 +5,31 @@ 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.7] - 2025-12-09
|
|
9
|
+
### Added
|
|
10
|
+
- `--backoff-factor` argument
|
|
11
|
+
### Changed
|
|
12
|
+
- CLI messages updated
|
|
13
|
+
- `Python 3.14` added to `test.yml`
|
|
14
|
+
- Internal functions default values removed
|
|
15
|
+
- `README.md` updated
|
|
16
|
+
- Test system modified
|
|
17
|
+
- `ipspot_info` function renamed to `_print_ipspot_info`
|
|
18
|
+
- `display_ip_info` function renamed to `_print_report`
|
|
19
|
+
## [0.6] - 2025-11-18
|
|
20
|
+
### Added
|
|
21
|
+
- `ForceIPHTTPAdapter` class
|
|
22
|
+
- `_get_json_force_ip` function
|
|
23
|
+
- Support [ifconfig.co](https://ifconfig.co/json) IPv6 API
|
|
24
|
+
- Support [reallyfreegeoip.org](https://reallyfreegeoip.org/json/) IPv6 API
|
|
25
|
+
- Support [myip.la](https://api.myip.la/en?json) IPv6 API
|
|
26
|
+
- Support [freeipapi.com](https://freeipapi.com/api/json) IPv6 API
|
|
27
|
+
### Changed
|
|
28
|
+
- [freeipapi.com](https://freeipapi.com/api/json) IPv4 API bug fixed
|
|
29
|
+
- `README.md` updated
|
|
30
|
+
### Removed
|
|
31
|
+
- `IPv4HTTPAdapter` class
|
|
32
|
+
- `_get_json_ipv4_forced` function
|
|
8
33
|
## [0.5] - 2025-10-17
|
|
9
34
|
### Added
|
|
10
35
|
- `setup-warp` action
|
|
@@ -83,7 +108,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
83
108
|
- `--no-geo` argument
|
|
84
109
|
- Logo
|
|
85
110
|
|
|
86
|
-
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.
|
|
111
|
+
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.7...dev
|
|
112
|
+
[0.7]: https://github.com/openscilab/ipspot/compare/v0.6...v0.7
|
|
113
|
+
[0.6]: https://github.com/openscilab/ipspot/compare/v0.5...v0.6
|
|
87
114
|
[0.5]: https://github.com/openscilab/ipspot/compare/v0.4...v0.5
|
|
88
115
|
[0.4]: https://github.com/openscilab/ipspot/compare/v0.3...v0.4
|
|
89
116
|
[0.3]: https://github.com/openscilab/ipspot/compare/v0.2...v0.3
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ipspot
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7
|
|
4
4
|
Summary: IPSpot: A Python Tool to Fetch the System's IP Address
|
|
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.7
|
|
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
11
|
Keywords: ip ipv4 geo geolocation network location ipspot cli
|
|
12
|
-
Classifier: Development Status ::
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Natural Language :: English
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
@@ -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
|
|
@@ -52,6 +53,7 @@ Dynamic: summary
|
|
|
52
53
|
<img src="https://github.com/openscilab/ipspot/raw/main/otherfiles/logo.png" width="350">
|
|
53
54
|
<h1>IPSpot: A Python Tool to Fetch the System's IP Address</h1>
|
|
54
55
|
<br/>
|
|
56
|
+
<a href="https://codecov.io/gh/openscilab/ipspot"><img src="https://codecov.io/gh/openscilab/ipspot/graph/badge.svg?token=XCFKASULS8"></a>
|
|
55
57
|
<a href="https://badge.fury.io/py/ipspot"><img src="https://badge.fury.io/py/ipspot.svg" alt="PyPI version"></a>
|
|
56
58
|
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
|
|
57
59
|
<a href="https://github.com/openscilab/ipspot"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/openscilab/ipspot"></a>
|
|
@@ -102,13 +104,13 @@ Dynamic: summary
|
|
|
102
104
|
## Installation
|
|
103
105
|
|
|
104
106
|
### Source Code
|
|
105
|
-
- Download [Version 0.
|
|
107
|
+
- Download [Version 0.7](https://github.com/openscilab/ipspot/archive/v0.7.zip) or [Latest Source](https://github.com/openscilab/ipspot/archive/dev.zip)
|
|
106
108
|
- `pip install .`
|
|
107
109
|
|
|
108
110
|
### PyPI
|
|
109
111
|
|
|
110
112
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
111
|
-
- `pip install ipspot==0.
|
|
113
|
+
- `pip install ipspot==0.7`
|
|
112
114
|
|
|
113
115
|
|
|
114
116
|
## Usage
|
|
@@ -123,7 +125,7 @@ Dynamic: summary
|
|
|
123
125
|
{'status': True, 'data': {'ip': 'xx.xx.xx.xx', 'api': 'ip-api.com'}}
|
|
124
126
|
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10)
|
|
125
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}
|
|
126
|
-
>>> 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)
|
|
127
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}
|
|
128
130
|
```
|
|
129
131
|
|
|
@@ -143,7 +145,7 @@ Dynamic: summary
|
|
|
143
145
|
{'data': {'api': 'ip.sb', 'ip': 'xx:xx:xx:xx::xx'}, 'status': True}
|
|
144
146
|
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10)
|
|
145
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}
|
|
146
|
-
>>> 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)
|
|
147
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}
|
|
148
150
|
```
|
|
149
151
|
|
|
@@ -164,7 +166,7 @@ Dynamic: summary
|
|
|
164
166
|
```console
|
|
165
167
|
> ipspot --version
|
|
166
168
|
|
|
167
|
-
0.
|
|
169
|
+
0.7
|
|
168
170
|
```
|
|
169
171
|
|
|
170
172
|
#### Info
|
|
@@ -172,18 +174,18 @@ Dynamic: summary
|
|
|
172
174
|
```console
|
|
173
175
|
> ipspot --info
|
|
174
176
|
|
|
175
|
-
___ ____ ____ _
|
|
176
|
-
|_ _|| _ \ / ___| _ __ ___ | |_
|
|
177
|
+
___ ____ ____ _
|
|
178
|
+
|_ _|| _ \ / ___| _ __ ___ | |_
|
|
177
179
|
| | | |_) |\___ \ | '_ \ / _ \ | __|
|
|
178
|
-
| | | __/ ___) || |_) || (_) || |_
|
|
180
|
+
| | | __/ ___) || |_) || (_) || |_
|
|
179
181
|
|___||_| |____/ | .__/ \___/ \__|
|
|
180
|
-
|_|
|
|
182
|
+
|_|
|
|
181
183
|
|
|
182
|
-
__ __ ___
|
|
183
|
-
\ \ / / _ / _ \ |
|
|
184
|
-
\ \ / / (_)| | | |
|
|
185
|
-
\ V / _ | |_| | _
|
|
186
|
-
\_/ (_) \___/ (_)
|
|
184
|
+
__ __ ___ _____
|
|
185
|
+
\ \ / / _ / _ \ |___ |
|
|
186
|
+
\ \ / / (_)| | | | / /
|
|
187
|
+
\ V / _ | |_| | _ / /
|
|
188
|
+
\_/ (_) \___/ (_) /_/
|
|
187
189
|
|
|
188
190
|
|
|
189
191
|
|
|
@@ -207,16 +209,31 @@ Private IP:
|
|
|
207
209
|
|
|
208
210
|
Public IP and Location Info:
|
|
209
211
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
212
|
+
IPv4:
|
|
213
|
+
|
|
214
|
+
API: ipinfo.io
|
|
215
|
+
City: Nuremberg
|
|
216
|
+
Country: Germany
|
|
217
|
+
Country Code: DE
|
|
218
|
+
IP: xx.xx.xx.xx
|
|
219
|
+
Latitude: 49.4527
|
|
220
|
+
Longitude: 11.0783
|
|
221
|
+
Organization: Hetzner Online GmbH
|
|
222
|
+
Region: Bavaria
|
|
223
|
+
Timezone: Europe/Berlin
|
|
224
|
+
|
|
225
|
+
IPv6:
|
|
226
|
+
|
|
227
|
+
API: ip.sb
|
|
228
|
+
City: N/A
|
|
229
|
+
Country: Germany
|
|
230
|
+
Country Code: DE
|
|
231
|
+
IP: xx:xx:xx:xx::xx
|
|
232
|
+
Latitude: 51.2993
|
|
233
|
+
Longitude: 9.491
|
|
234
|
+
Organization: Hetzner Online
|
|
235
|
+
Region: N/A
|
|
236
|
+
Timezone: Europe/Berlin
|
|
220
237
|
```
|
|
221
238
|
|
|
222
239
|
#### IPv4 API
|
|
@@ -264,7 +281,7 @@ Public IP and Location Info:
|
|
|
264
281
|
|
|
265
282
|
#### IPv6 API
|
|
266
283
|
|
|
267
|
-
ℹ️ `ipv6-api` valid choices: [`auto-safe`, `auto`, `ip.sb`, `ident.me`, `tnedi.me`, `ipleak.net`, `my-ip.io`]
|
|
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`]
|
|
268
285
|
|
|
269
286
|
ℹ️ The default value: `auto-safe`
|
|
270
287
|
|
|
@@ -360,6 +377,31 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
360
377
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
361
378
|
|
|
362
379
|
## [Unreleased]
|
|
380
|
+
## [0.7] - 2025-12-09
|
|
381
|
+
### Added
|
|
382
|
+
- `--backoff-factor` argument
|
|
383
|
+
### Changed
|
|
384
|
+
- CLI messages updated
|
|
385
|
+
- `Python 3.14` added to `test.yml`
|
|
386
|
+
- Internal functions default values removed
|
|
387
|
+
- `README.md` updated
|
|
388
|
+
- Test system modified
|
|
389
|
+
- `ipspot_info` function renamed to `_print_ipspot_info`
|
|
390
|
+
- `display_ip_info` function renamed to `_print_report`
|
|
391
|
+
## [0.6] - 2025-11-18
|
|
392
|
+
### Added
|
|
393
|
+
- `ForceIPHTTPAdapter` class
|
|
394
|
+
- `_get_json_force_ip` function
|
|
395
|
+
- Support [ifconfig.co](https://ifconfig.co/json) IPv6 API
|
|
396
|
+
- Support [reallyfreegeoip.org](https://reallyfreegeoip.org/json/) IPv6 API
|
|
397
|
+
- Support [myip.la](https://api.myip.la/en?json) IPv6 API
|
|
398
|
+
- Support [freeipapi.com](https://freeipapi.com/api/json) IPv6 API
|
|
399
|
+
### Changed
|
|
400
|
+
- [freeipapi.com](https://freeipapi.com/api/json) IPv4 API bug fixed
|
|
401
|
+
- `README.md` updated
|
|
402
|
+
### Removed
|
|
403
|
+
- `IPv4HTTPAdapter` class
|
|
404
|
+
- `_get_json_ipv4_forced` function
|
|
363
405
|
## [0.5] - 2025-10-17
|
|
364
406
|
### Added
|
|
365
407
|
- `setup-warp` action
|
|
@@ -438,7 +480,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
438
480
|
- `--no-geo` argument
|
|
439
481
|
- Logo
|
|
440
482
|
|
|
441
|
-
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.
|
|
483
|
+
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.7...dev
|
|
484
|
+
[0.7]: https://github.com/openscilab/ipspot/compare/v0.6...v0.7
|
|
485
|
+
[0.6]: https://github.com/openscilab/ipspot/compare/v0.5...v0.6
|
|
442
486
|
[0.5]: https://github.com/openscilab/ipspot/compare/v0.4...v0.5
|
|
443
487
|
[0.4]: https://github.com/openscilab/ipspot/compare/v0.3...v0.4
|
|
444
488
|
[0.3]: https://github.com/openscilab/ipspot/compare/v0.2...v0.3
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<img src="https://github.com/openscilab/ipspot/raw/main/otherfiles/logo.png" width="350">
|
|
3
3
|
<h1>IPSpot: A Python Tool to Fetch the System's IP Address</h1>
|
|
4
4
|
<br/>
|
|
5
|
+
<a href="https://codecov.io/gh/openscilab/ipspot"><img src="https://codecov.io/gh/openscilab/ipspot/graph/badge.svg?token=XCFKASULS8"></a>
|
|
5
6
|
<a href="https://badge.fury.io/py/ipspot"><img src="https://badge.fury.io/py/ipspot.svg" alt="PyPI version"></a>
|
|
6
7
|
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
|
|
7
8
|
<a href="https://github.com/openscilab/ipspot"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/openscilab/ipspot"></a>
|
|
@@ -52,13 +53,13 @@
|
|
|
52
53
|
## Installation
|
|
53
54
|
|
|
54
55
|
### Source Code
|
|
55
|
-
- Download [Version 0.
|
|
56
|
+
- Download [Version 0.7](https://github.com/openscilab/ipspot/archive/v0.7.zip) or [Latest Source](https://github.com/openscilab/ipspot/archive/dev.zip)
|
|
56
57
|
- `pip install .`
|
|
57
58
|
|
|
58
59
|
### PyPI
|
|
59
60
|
|
|
60
61
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
61
|
-
- `pip install ipspot==0.
|
|
62
|
+
- `pip install ipspot==0.7`
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
## Usage
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
{'status': True, 'data': {'ip': 'xx.xx.xx.xx', 'api': 'ip-api.com'}}
|
|
74
75
|
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10)
|
|
75
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}
|
|
76
|
-
>>> 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)
|
|
77
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}
|
|
78
79
|
```
|
|
79
80
|
|
|
@@ -93,7 +94,7 @@
|
|
|
93
94
|
{'data': {'api': 'ip.sb', 'ip': 'xx:xx:xx:xx::xx'}, 'status': True}
|
|
94
95
|
>>> get_public_ipv6(api=IPv6API.IP_SB, geo=True, timeout=10)
|
|
95
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}
|
|
96
|
-
>>> 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)
|
|
97
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}
|
|
98
99
|
```
|
|
99
100
|
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
```console
|
|
115
116
|
> ipspot --version
|
|
116
117
|
|
|
117
|
-
0.
|
|
118
|
+
0.7
|
|
118
119
|
```
|
|
119
120
|
|
|
120
121
|
#### Info
|
|
@@ -122,18 +123,18 @@
|
|
|
122
123
|
```console
|
|
123
124
|
> ipspot --info
|
|
124
125
|
|
|
125
|
-
___ ____ ____ _
|
|
126
|
-
|_ _|| _ \ / ___| _ __ ___ | |_
|
|
126
|
+
___ ____ ____ _
|
|
127
|
+
|_ _|| _ \ / ___| _ __ ___ | |_
|
|
127
128
|
| | | |_) |\___ \ | '_ \ / _ \ | __|
|
|
128
|
-
| | | __/ ___) || |_) || (_) || |_
|
|
129
|
+
| | | __/ ___) || |_) || (_) || |_
|
|
129
130
|
|___||_| |____/ | .__/ \___/ \__|
|
|
130
|
-
|_|
|
|
131
|
+
|_|
|
|
131
132
|
|
|
132
|
-
__ __ ___
|
|
133
|
-
\ \ / / _ / _ \ |
|
|
134
|
-
\ \ / / (_)| | | |
|
|
135
|
-
\ V / _ | |_| | _
|
|
136
|
-
\_/ (_) \___/ (_)
|
|
133
|
+
__ __ ___ _____
|
|
134
|
+
\ \ / / _ / _ \ |___ |
|
|
135
|
+
\ \ / / (_)| | | | / /
|
|
136
|
+
\ V / _ | |_| | _ / /
|
|
137
|
+
\_/ (_) \___/ (_) /_/
|
|
137
138
|
|
|
138
139
|
|
|
139
140
|
|
|
@@ -157,16 +158,31 @@ Private IP:
|
|
|
157
158
|
|
|
158
159
|
Public IP and Location Info:
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
161
|
+
IPv4:
|
|
162
|
+
|
|
163
|
+
API: ipinfo.io
|
|
164
|
+
City: Nuremberg
|
|
165
|
+
Country: Germany
|
|
166
|
+
Country Code: DE
|
|
167
|
+
IP: xx.xx.xx.xx
|
|
168
|
+
Latitude: 49.4527
|
|
169
|
+
Longitude: 11.0783
|
|
170
|
+
Organization: Hetzner Online GmbH
|
|
171
|
+
Region: Bavaria
|
|
172
|
+
Timezone: Europe/Berlin
|
|
173
|
+
|
|
174
|
+
IPv6:
|
|
175
|
+
|
|
176
|
+
API: ip.sb
|
|
177
|
+
City: N/A
|
|
178
|
+
Country: Germany
|
|
179
|
+
Country Code: DE
|
|
180
|
+
IP: xx:xx:xx:xx::xx
|
|
181
|
+
Latitude: 51.2993
|
|
182
|
+
Longitude: 9.491
|
|
183
|
+
Organization: Hetzner Online
|
|
184
|
+
Region: N/A
|
|
185
|
+
Timezone: Europe/Berlin
|
|
170
186
|
```
|
|
171
187
|
|
|
172
188
|
#### IPv4 API
|
|
@@ -214,7 +230,7 @@ Public IP and Location Info:
|
|
|
214
230
|
|
|
215
231
|
#### IPv6 API
|
|
216
232
|
|
|
217
|
-
ℹ️ `ipv6-api` valid choices: [`auto-safe`, `auto`, `ip.sb`, `ident.me`, `tnedi.me`, `ipleak.net`, `my-ip.io`]
|
|
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`]
|
|
218
234
|
|
|
219
235
|
ℹ️ The default value: `auto-safe`
|
|
220
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)
|