ipspot 0.3__tar.gz → 0.4__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.3 → ipspot-0.4}/AUTHORS.md +2 -0
- {ipspot-0.3 → ipspot-0.4}/CHANGELOG.md +25 -1
- {ipspot-0.3 → ipspot-0.4}/PKG-INFO +42 -16
- {ipspot-0.3 → ipspot-0.4}/README.md +15 -13
- {ipspot-0.3 → ipspot-0.4}/SECURITY.md +2 -2
- {ipspot-0.3 → ipspot-0.4}/ipspot/cli.py +22 -7
- ipspot-0.4/ipspot/ipv4.py +540 -0
- {ipspot-0.3 → ipspot-0.4}/ipspot/params.py +14 -6
- ipspot-0.4/ipspot/utils.py +69 -0
- {ipspot-0.3 → ipspot-0.4}/ipspot.egg-info/PKG-INFO +42 -16
- {ipspot-0.3 → ipspot-0.4}/setup.py +2 -2
- ipspot-0.4/tests/test_ipv4.py +358 -0
- ipspot-0.4/tests/test_utils.py +67 -0
- ipspot-0.3/ipspot/ipv4.py +0 -273
- ipspot-0.3/ipspot/utils.py +0 -30
- ipspot-0.3/tests/test_ipv4.py +0 -202
- ipspot-0.3/tests/test_utils.py +0 -24
- {ipspot-0.3 → ipspot-0.4}/LICENSE +0 -0
- {ipspot-0.3 → ipspot-0.4}/MANIFEST.in +0 -0
- {ipspot-0.3 → ipspot-0.4}/dev-requirements.txt +0 -0
- {ipspot-0.3 → ipspot-0.4}/ipspot/__init__.py +0 -0
- {ipspot-0.3 → ipspot-0.4}/ipspot/__main__.py +0 -0
- {ipspot-0.3 → ipspot-0.4}/ipspot.egg-info/SOURCES.txt +0 -0
- {ipspot-0.3 → ipspot-0.4}/ipspot.egg-info/dependency_links.txt +0 -0
- {ipspot-0.3 → ipspot-0.4}/ipspot.egg-info/entry_points.txt +0 -0
- {ipspot-0.3 → ipspot-0.4}/ipspot.egg-info/requires.txt +0 -0
- {ipspot-0.3 → ipspot-0.4}/ipspot.egg-info/top_level.txt +0 -0
- {ipspot-0.3 → ipspot-0.4}/requirements.txt +0 -0
- {ipspot-0.3 → ipspot-0.4}/setup.cfg +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Core Developers
|
|
2
2
|
----------
|
|
3
3
|
- Sepand Haghighi - Open Science Laboratory ([Github](https://github.com/sepandhaghighi)) **
|
|
4
|
+
- Sadra Sabouri - Open Science Laboratory ([Github](https://github.com/sadrasabouri))
|
|
5
|
+
- AmirHosein Rostami - Open Science Laboratory ([Github](https://github.com/AHReccese))
|
|
4
6
|
|
|
5
7
|
** **Maintainer**
|
|
6
8
|
|
|
@@ -5,6 +5,29 @@ 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.4] - 2025-06-09
|
|
9
|
+
### Added
|
|
10
|
+
- Support [ipapi.co](https://ipapi.co/json/)
|
|
11
|
+
- Support [ipleak.net](https://ipleak.net/json/)
|
|
12
|
+
- Support [my-ip.io](https://www.my-ip.io/)
|
|
13
|
+
- Support [ifconfig.co](https://ifconfig.co/json)
|
|
14
|
+
- Support [reallyfreegeoip.org](https://reallyfreegeoip.org/json/)
|
|
15
|
+
- Support [myip.la](https://api.myip.la/en?json)
|
|
16
|
+
- Support [freeipapi.com](https://freeipapi.com/api/json/)
|
|
17
|
+
- `AUTO_SAFE` mode
|
|
18
|
+
- `_get_json_standard` function
|
|
19
|
+
- `_get_json_ipv4_forced` function
|
|
20
|
+
- `--max-retries` argument
|
|
21
|
+
- `--retry-delay` argument
|
|
22
|
+
### Changed
|
|
23
|
+
- `IPv4API.IPAPI` renamed to `IPv4API.IP_API_COM`
|
|
24
|
+
- `IPv4API.IPINFO` renamed to `IPv4API.IPINFO_IO`
|
|
25
|
+
- `IPv4API.IPSB` renamed to `IPv4API.IP_SB`
|
|
26
|
+
- `IPv4API.IDENTME` renamed to `IPv4API.IDENT_ME`
|
|
27
|
+
- `IPv4API.TNEDIME` renamed to `IPv4API.TNEDI_ME`
|
|
28
|
+
- `get_public_ipv4` function modified
|
|
29
|
+
- `filter_parameter` function renamed to `_filter_parameter`
|
|
30
|
+
- `README.md` updated
|
|
8
31
|
## [0.3] - 2025-05-19
|
|
9
32
|
### Added
|
|
10
33
|
- `is_ipv4` function
|
|
@@ -41,7 +64,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
41
64
|
- `--no-geo` argument
|
|
42
65
|
- Logo
|
|
43
66
|
|
|
44
|
-
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.
|
|
67
|
+
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.4...dev
|
|
68
|
+
[0.4]: https://github.com/openscilab/ipspot/compare/v0.3...v0.4
|
|
45
69
|
[0.3]: https://github.com/openscilab/ipspot/compare/v0.2...v0.3
|
|
46
70
|
[0.2]: https://github.com/openscilab/ipspot/compare/v0.1...v0.2
|
|
47
71
|
[0.1]: https://github.com/openscilab/ipspot/compare/3216fb7...v0.1
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ipspot
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4
|
|
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.4
|
|
7
7
|
Author: IPSpot Development Team
|
|
8
8
|
Author-email: ipspot@openscilab.com
|
|
9
9
|
License: MIT
|
|
@@ -102,13 +102,13 @@ Dynamic: summary
|
|
|
102
102
|
## Installation
|
|
103
103
|
|
|
104
104
|
### Source Code
|
|
105
|
-
- Download [Version 0.
|
|
105
|
+
- Download [Version 0.4](https://github.com/openscilab/ipspot/archive/v0.4.zip) or [Latest Source](https://github.com/openscilab/ipspot/archive/dev.zip)
|
|
106
106
|
- `pip install .`
|
|
107
107
|
|
|
108
108
|
### PyPI
|
|
109
109
|
|
|
110
110
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
111
|
-
- `pip install ipspot==0.
|
|
111
|
+
- `pip install ipspot==0.4`
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
## Usage
|
|
@@ -119,9 +119,11 @@ Dynamic: summary
|
|
|
119
119
|
|
|
120
120
|
```pycon
|
|
121
121
|
>>> from ipspot import get_public_ipv4, IPv4API
|
|
122
|
-
>>> get_public_ipv4(api=IPv4API.
|
|
122
|
+
>>> get_public_ipv4(api=IPv4API.IP_API_COM)
|
|
123
123
|
{'status': True, 'data': {'ip': 'xx.xx.xx.xx', 'api': 'ip-api.com'}}
|
|
124
|
-
>>> get_public_ipv4(api=IPv4API.
|
|
124
|
+
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10)
|
|
125
|
+
{'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)
|
|
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
128
|
```
|
|
127
129
|
|
|
@@ -142,7 +144,7 @@ Dynamic: summary
|
|
|
142
144
|
```console
|
|
143
145
|
> ipspot --version
|
|
144
146
|
|
|
145
|
-
0.
|
|
147
|
+
0.4
|
|
146
148
|
```
|
|
147
149
|
|
|
148
150
|
#### Info
|
|
@@ -157,11 +159,11 @@ Dynamic: summary
|
|
|
157
159
|
|___||_| |____/ | .__/ \___/ \__|
|
|
158
160
|
|_|
|
|
159
161
|
|
|
160
|
-
__ __ ___
|
|
161
|
-
\ \ / / _ / _ \ |
|
|
162
|
-
\ \ / / (_)| | | |
|
|
163
|
-
\ V / _ | |_| | _
|
|
164
|
-
\_/ (_) \___/ (_)|
|
|
162
|
+
__ __ ___ _ _
|
|
163
|
+
\ \ / / _ / _ \ | || |
|
|
164
|
+
\ \ / / (_)| | | | | || |_
|
|
165
|
+
\ V / _ | |_| | _ |__ _|
|
|
166
|
+
\_/ (_) \___/ (_) |_|
|
|
165
167
|
|
|
166
168
|
|
|
167
169
|
|
|
@@ -197,12 +199,12 @@ Public IP and Location Info:
|
|
|
197
199
|
|
|
198
200
|
#### IPv4 API
|
|
199
201
|
|
|
200
|
-
ℹ️ `ipv4-api` valid choices: [`auto`, `
|
|
202
|
+
ℹ️ `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`]
|
|
201
203
|
|
|
202
|
-
ℹ️ The default value: `auto`
|
|
204
|
+
ℹ️ The default value: `auto-safe`
|
|
203
205
|
|
|
204
206
|
```console
|
|
205
|
-
> ipspot --ipv4-api="ipinfo"
|
|
207
|
+
> ipspot --ipv4-api="ipinfo.io"
|
|
206
208
|
Private IP:
|
|
207
209
|
|
|
208
210
|
10.36.18.154
|
|
@@ -267,6 +269,29 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
267
269
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
268
270
|
|
|
269
271
|
## [Unreleased]
|
|
272
|
+
## [0.4] - 2025-06-09
|
|
273
|
+
### Added
|
|
274
|
+
- Support [ipapi.co](https://ipapi.co/json/)
|
|
275
|
+
- Support [ipleak.net](https://ipleak.net/json/)
|
|
276
|
+
- Support [my-ip.io](https://www.my-ip.io/)
|
|
277
|
+
- Support [ifconfig.co](https://ifconfig.co/json)
|
|
278
|
+
- Support [reallyfreegeoip.org](https://reallyfreegeoip.org/json/)
|
|
279
|
+
- Support [myip.la](https://api.myip.la/en?json)
|
|
280
|
+
- Support [freeipapi.com](https://freeipapi.com/api/json/)
|
|
281
|
+
- `AUTO_SAFE` mode
|
|
282
|
+
- `_get_json_standard` function
|
|
283
|
+
- `_get_json_ipv4_forced` function
|
|
284
|
+
- `--max-retries` argument
|
|
285
|
+
- `--retry-delay` argument
|
|
286
|
+
### Changed
|
|
287
|
+
- `IPv4API.IPAPI` renamed to `IPv4API.IP_API_COM`
|
|
288
|
+
- `IPv4API.IPINFO` renamed to `IPv4API.IPINFO_IO`
|
|
289
|
+
- `IPv4API.IPSB` renamed to `IPv4API.IP_SB`
|
|
290
|
+
- `IPv4API.IDENTME` renamed to `IPv4API.IDENT_ME`
|
|
291
|
+
- `IPv4API.TNEDIME` renamed to `IPv4API.TNEDI_ME`
|
|
292
|
+
- `get_public_ipv4` function modified
|
|
293
|
+
- `filter_parameter` function renamed to `_filter_parameter`
|
|
294
|
+
- `README.md` updated
|
|
270
295
|
## [0.3] - 2025-05-19
|
|
271
296
|
### Added
|
|
272
297
|
- `is_ipv4` function
|
|
@@ -303,7 +328,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
303
328
|
- `--no-geo` argument
|
|
304
329
|
- Logo
|
|
305
330
|
|
|
306
|
-
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.
|
|
331
|
+
[Unreleased]: https://github.com/openscilab/ipspot/compare/v0.4...dev
|
|
332
|
+
[0.4]: https://github.com/openscilab/ipspot/compare/v0.3...v0.4
|
|
307
333
|
[0.3]: https://github.com/openscilab/ipspot/compare/v0.2...v0.3
|
|
308
334
|
[0.2]: https://github.com/openscilab/ipspot/compare/v0.1...v0.2
|
|
309
335
|
[0.1]: https://github.com/openscilab/ipspot/compare/3216fb7...v0.1
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
## Installation
|
|
53
53
|
|
|
54
54
|
### Source Code
|
|
55
|
-
- Download [Version 0.
|
|
55
|
+
- Download [Version 0.4](https://github.com/openscilab/ipspot/archive/v0.4.zip) or [Latest Source](https://github.com/openscilab/ipspot/archive/dev.zip)
|
|
56
56
|
- `pip install .`
|
|
57
57
|
|
|
58
58
|
### PyPI
|
|
59
59
|
|
|
60
60
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
61
|
-
- `pip install ipspot==0.
|
|
61
|
+
- `pip install ipspot==0.4`
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
## Usage
|
|
@@ -69,9 +69,11 @@
|
|
|
69
69
|
|
|
70
70
|
```pycon
|
|
71
71
|
>>> from ipspot import get_public_ipv4, IPv4API
|
|
72
|
-
>>> get_public_ipv4(api=IPv4API.
|
|
72
|
+
>>> get_public_ipv4(api=IPv4API.IP_API_COM)
|
|
73
73
|
{'status': True, 'data': {'ip': 'xx.xx.xx.xx', 'api': 'ip-api.com'}}
|
|
74
|
-
>>> get_public_ipv4(api=IPv4API.
|
|
74
|
+
>>> get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout=10)
|
|
75
|
+
{'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)
|
|
75
77
|
{'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
78
|
```
|
|
77
79
|
|
|
@@ -92,7 +94,7 @@
|
|
|
92
94
|
```console
|
|
93
95
|
> ipspot --version
|
|
94
96
|
|
|
95
|
-
0.
|
|
97
|
+
0.4
|
|
96
98
|
```
|
|
97
99
|
|
|
98
100
|
#### Info
|
|
@@ -107,11 +109,11 @@
|
|
|
107
109
|
|___||_| |____/ | .__/ \___/ \__|
|
|
108
110
|
|_|
|
|
109
111
|
|
|
110
|
-
__ __ ___
|
|
111
|
-
\ \ / / _ / _ \ |
|
|
112
|
-
\ \ / / (_)| | | |
|
|
113
|
-
\ V / _ | |_| | _
|
|
114
|
-
\_/ (_) \___/ (_)|
|
|
112
|
+
__ __ ___ _ _
|
|
113
|
+
\ \ / / _ / _ \ | || |
|
|
114
|
+
\ \ / / (_)| | | | | || |_
|
|
115
|
+
\ V / _ | |_| | _ |__ _|
|
|
116
|
+
\_/ (_) \___/ (_) |_|
|
|
115
117
|
|
|
116
118
|
|
|
117
119
|
|
|
@@ -147,12 +149,12 @@ Public IP and Location Info:
|
|
|
147
149
|
|
|
148
150
|
#### IPv4 API
|
|
149
151
|
|
|
150
|
-
ℹ️ `ipv4-api` valid choices: [`auto`, `
|
|
152
|
+
ℹ️ `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`]
|
|
151
153
|
|
|
152
|
-
ℹ️ The default value: `auto`
|
|
154
|
+
ℹ️ The default value: `auto-safe`
|
|
153
155
|
|
|
154
156
|
```console
|
|
155
|
-
> ipspot --ipv4-api="ipinfo"
|
|
157
|
+
> ipspot --ipv4-api="ipinfo.io"
|
|
156
158
|
Private IP:
|
|
157
159
|
|
|
158
160
|
10.36.18.154
|
|
@@ -4,7 +4,7 @@ import argparse
|
|
|
4
4
|
from typing import Union, Tuple
|
|
5
5
|
from art import tprint
|
|
6
6
|
from .ipv4 import get_public_ipv4, get_private_ipv4
|
|
7
|
-
from .utils import
|
|
7
|
+
from .utils import _filter_parameter
|
|
8
8
|
from .params import IPv4API, PARAMETERS_NAME_MAP
|
|
9
9
|
from .params import IPSPOT_OVERVIEW, IPSPOT_REPO, IPSPOT_VERSION
|
|
10
10
|
|
|
@@ -17,14 +17,17 @@ def ipspot_info() -> None: # pragma: no cover
|
|
|
17
17
|
print("Repo : " + IPSPOT_REPO)
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def display_ip_info(ipv4_api: IPv4API = IPv4API.
|
|
21
|
-
timeout: Union[float, Tuple[float, float]]=5
|
|
20
|
+
def display_ip_info(ipv4_api: IPv4API = IPv4API.AUTO_SAFE, geo: bool=False,
|
|
21
|
+
timeout: Union[float, Tuple[float, float]]=5,
|
|
22
|
+
max_retries: int = 0, retry_delay: float = 1.0) -> None: # pragma: no cover
|
|
22
23
|
"""
|
|
23
24
|
Print collected IP and location data.
|
|
24
25
|
|
|
25
26
|
:param ipv4_api: public IPv4 API
|
|
26
27
|
:param geo: geolocation flag
|
|
27
28
|
:param timeout: timeout value for API
|
|
29
|
+
:param max_retries: number of retries
|
|
30
|
+
:param retry_delay: delay between retries (in seconds)
|
|
28
31
|
"""
|
|
29
32
|
private_result = get_private_ipv4()
|
|
30
33
|
print("Private IP:\n")
|
|
@@ -36,13 +39,18 @@ def display_ip_info(ipv4_api: IPv4API = IPv4API.AUTO, geo: bool=False,
|
|
|
36
39
|
public_title += " and Location Info"
|
|
37
40
|
public_title += ":\n"
|
|
38
41
|
print(public_title)
|
|
39
|
-
public_result = get_public_ipv4(
|
|
42
|
+
public_result = get_public_ipv4(
|
|
43
|
+
ipv4_api,
|
|
44
|
+
geo=geo,
|
|
45
|
+
timeout=timeout,
|
|
46
|
+
max_retries=max_retries,
|
|
47
|
+
retry_delay=retry_delay)
|
|
40
48
|
if public_result["status"]:
|
|
41
49
|
for name, parameter in sorted(public_result["data"].items()):
|
|
42
50
|
print(
|
|
43
51
|
" {name}: {parameter}".format(
|
|
44
52
|
name=PARAMETERS_NAME_MAP[name],
|
|
45
|
-
parameter=
|
|
53
|
+
parameter=_filter_parameter(parameter)))
|
|
46
54
|
else:
|
|
47
55
|
print(" Error: {public_result[error]}".format(public_result=public_result))
|
|
48
56
|
|
|
@@ -56,11 +64,13 @@ def main() -> None: # pragma: no cover
|
|
|
56
64
|
type=str.lower,
|
|
57
65
|
choices=[
|
|
58
66
|
x.value for x in IPv4API],
|
|
59
|
-
default=IPv4API.
|
|
67
|
+
default=IPv4API.AUTO_SAFE.value)
|
|
60
68
|
parser.add_argument('--info', help='info', nargs="?", const=1)
|
|
61
69
|
parser.add_argument('--version', help='version', nargs="?", const=1)
|
|
62
70
|
parser.add_argument('--no-geo', help='no geolocation data', nargs="?", const=1, default=False)
|
|
63
71
|
parser.add_argument('--timeout', help='timeout for the API request', type=float, default=5.0)
|
|
72
|
+
parser.add_argument('--max-retries', help='number of retries', type=int, default=0)
|
|
73
|
+
parser.add_argument('--retry-delay', help='delay between retries (in seconds)', type=float, default=1.0)
|
|
64
74
|
|
|
65
75
|
args = parser.parse_args()
|
|
66
76
|
if args.version:
|
|
@@ -70,4 +80,9 @@ def main() -> None: # pragma: no cover
|
|
|
70
80
|
else:
|
|
71
81
|
ipv4_api = IPv4API(args.ipv4_api)
|
|
72
82
|
geo = not args.no_geo
|
|
73
|
-
display_ip_info(
|
|
83
|
+
display_ip_info(
|
|
84
|
+
ipv4_api=ipv4_api,
|
|
85
|
+
geo=geo,
|
|
86
|
+
timeout=args.timeout,
|
|
87
|
+
max_retries=args.max_retries,
|
|
88
|
+
retry_delay=args.retry_delay)
|