ipspot 0.7__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.7 → ipspot-0.8}/CHANGELOG.md +10 -1
- {ipspot-0.7 → ipspot-0.8}/PKG-INFO +29 -20
- {ipspot-0.7 → ipspot-0.8}/README.md +15 -15
- {ipspot-0.7 → ipspot-0.8}/SECURITY.md +2 -2
- {ipspot-0.7 → ipspot-0.8}/ipspot/ipv4.py +68 -2
- {ipspot-0.7 → ipspot-0.8}/ipspot/ipv6.py +69 -3
- {ipspot-0.7 → ipspot-0.8}/ipspot/params.py +8 -4
- {ipspot-0.7 → ipspot-0.8}/ipspot.egg-info/PKG-INFO +29 -20
- {ipspot-0.7 → ipspot-0.8}/setup.py +7 -7
- {ipspot-0.7 → ipspot-0.8}/tests/test_ipv4_api.py +16 -0
- {ipspot-0.7 → ipspot-0.8}/tests/test_ipv4_functions.py +12 -51
- {ipspot-0.7 → ipspot-0.8}/tests/test_ipv6_api.py +17 -1
- {ipspot-0.7 → ipspot-0.8}/AUTHORS.md +0 -0
- {ipspot-0.7 → ipspot-0.8}/LICENSE +0 -0
- {ipspot-0.7 → ipspot-0.8}/MANIFEST.in +0 -0
- {ipspot-0.7 → ipspot-0.8}/dev-requirements.txt +0 -0
- {ipspot-0.7 → ipspot-0.8}/ipspot/__init__.py +0 -0
- {ipspot-0.7 → ipspot-0.8}/ipspot/__main__.py +0 -0
- {ipspot-0.7 → ipspot-0.8}/ipspot/cli.py +0 -0
- {ipspot-0.7 → ipspot-0.8}/ipspot/utils.py +0 -0
- {ipspot-0.7 → ipspot-0.8}/ipspot.egg-info/SOURCES.txt +0 -0
- {ipspot-0.7 → ipspot-0.8}/ipspot.egg-info/dependency_links.txt +0 -0
- {ipspot-0.7 → ipspot-0.8}/ipspot.egg-info/entry_points.txt +0 -0
- {ipspot-0.7 → ipspot-0.8}/ipspot.egg-info/requires.txt +0 -0
- {ipspot-0.7 → ipspot-0.8}/ipspot.egg-info/top_level.txt +0 -0
- {ipspot-0.7 → ipspot-0.8}/requirements.txt +0 -0
- {ipspot-0.7 → ipspot-0.8}/setup.cfg +0 -0
- {ipspot-0.7 → ipspot-0.8}/tests/test_ipv6_functions.py +0 -0
- {ipspot-0.7 → ipspot-0.8}/tests/test_utils.py +0 -0
|
@@ -5,6 +5,14 @@ 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
|
|
8
16
|
## [0.7] - 2025-12-09
|
|
9
17
|
### Added
|
|
10
18
|
- `--backoff-factor` argument
|
|
@@ -108,7 +116,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
108
116
|
- `--no-geo` argument
|
|
109
117
|
- Logo
|
|
110
118
|
|
|
111
|
-
[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
|
|
112
121
|
[0.7]: https://github.com/openscilab/ipspot/compare/v0.6...v0.7
|
|
113
122
|
[0.6]: https://github.com/openscilab/ipspot/compare/v0.5...v0.6
|
|
114
123
|
[0.5]: https://github.com/openscilab/ipspot/compare/v0.4...v0.5
|
|
@@ -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
|
|
@@ -51,7 +51,7 @@ Dynamic: summary
|
|
|
51
51
|
|
|
52
52
|
<div align="center">
|
|
53
53
|
<img src="https://github.com/openscilab/ipspot/raw/main/otherfiles/logo.png" width="350">
|
|
54
|
-
<h1>IPSpot:
|
|
54
|
+
<h1>IPSpot: Retrieve IPv4/IPv6 Addresses with Geolocation Data</h1>
|
|
55
55
|
<br/>
|
|
56
56
|
<a href="https://codecov.io/gh/openscilab/ipspot"><img src="https://codecov.io/gh/openscilab/ipspot/graph/badge.svg?token=XCFKASULS8"></a>
|
|
57
57
|
<a href="https://badge.fury.io/py/ipspot"><img src="https://badge.fury.io/py/ipspot.svg" alt="PyPI version"></a>
|
|
@@ -63,7 +63,7 @@ Dynamic: summary
|
|
|
63
63
|
## Overview
|
|
64
64
|
|
|
65
65
|
<p align="justify">
|
|
66
|
-
<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.
|
|
67
67
|
</p>
|
|
68
68
|
|
|
69
69
|
<table>
|
|
@@ -104,13 +104,13 @@ Dynamic: summary
|
|
|
104
104
|
## Installation
|
|
105
105
|
|
|
106
106
|
### Source Code
|
|
107
|
-
- 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)
|
|
108
108
|
- `pip install .`
|
|
109
109
|
|
|
110
110
|
### PyPI
|
|
111
111
|
|
|
112
112
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
113
|
-
- `pip install ipspot==0.
|
|
113
|
+
- `pip install ipspot==0.8`
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
## Usage
|
|
@@ -166,7 +166,7 @@ Dynamic: summary
|
|
|
166
166
|
```console
|
|
167
167
|
> ipspot --version
|
|
168
168
|
|
|
169
|
-
0.
|
|
169
|
+
0.8
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
#### Info
|
|
@@ -181,17 +181,17 @@ Dynamic: summary
|
|
|
181
181
|
|___||_| |____/ | .__/ \___/ \__|
|
|
182
182
|
|_|
|
|
183
183
|
|
|
184
|
-
__ __ ___
|
|
185
|
-
\ \ / / _ / _ \
|
|
186
|
-
\ \ / / (_)| | | |
|
|
187
|
-
\ V / _ | |_| | _
|
|
188
|
-
\_/ (_) \___/ (_) /
|
|
184
|
+
__ __ ___ ___
|
|
185
|
+
\ \ / / _ / _ \ ( _ )
|
|
186
|
+
\ \ / / (_)| | | | / _ \
|
|
187
|
+
\ V / _ | |_| | _ | (_) |
|
|
188
|
+
\_/ (_) \___/ (_) \___/
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
|
|
192
|
-
IPSpot is a Python library for retrieving the current system's IP
|
|
193
|
-
It
|
|
194
|
-
|
|
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.
|
|
195
195
|
|
|
196
196
|
Repo : https://github.com/openscilab/ipspot
|
|
197
197
|
|
|
@@ -238,7 +238,7 @@ Public IP and Location Info:
|
|
|
238
238
|
|
|
239
239
|
#### IPv4 API
|
|
240
240
|
|
|
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`]
|
|
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`]
|
|
242
242
|
|
|
243
243
|
ℹ️ The default value: `auto-safe`
|
|
244
244
|
|
|
@@ -281,7 +281,7 @@ Public IP and Location Info:
|
|
|
281
281
|
|
|
282
282
|
#### IPv6 API
|
|
283
283
|
|
|
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`]
|
|
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`]
|
|
285
285
|
|
|
286
286
|
ℹ️ The default value: `auto-safe`
|
|
287
287
|
|
|
@@ -377,6 +377,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
377
377
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
378
378
|
|
|
379
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
|
|
380
388
|
## [0.7] - 2025-12-09
|
|
381
389
|
### Added
|
|
382
390
|
- `--backoff-factor` argument
|
|
@@ -480,7 +488,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
480
488
|
- `--no-geo` argument
|
|
481
489
|
- Logo
|
|
482
490
|
|
|
483
|
-
[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
|
|
484
493
|
[0.7]: https://github.com/openscilab/ipspot/compare/v0.6...v0.7
|
|
485
494
|
[0.6]: https://github.com/openscilab/ipspot/compare/v0.5...v0.6
|
|
486
495
|
[0.5]: https://github.com/openscilab/ipspot/compare/v0.4...v0.5
|
|
@@ -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
|
|
@@ -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
|
|
@@ -130,17 +130,17 @@
|
|
|
130
130
|
|___||_| |____/ | .__/ \___/ \__|
|
|
131
131
|
|_|
|
|
132
132
|
|
|
133
|
-
__ __ ___
|
|
134
|
-
\ \ / / _ / _ \
|
|
135
|
-
\ \ / / (_)| | | |
|
|
136
|
-
\ V / _ | |_| | _
|
|
137
|
-
\_/ (_) \___/ (_) /
|
|
133
|
+
__ __ ___ ___
|
|
134
|
+
\ \ / / _ / _ \ ( _ )
|
|
135
|
+
\ \ / / (_)| | | | / _ \
|
|
136
|
+
\ V / _ | |_| | _ | (_) |
|
|
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
|
|
|
@@ -466,6 +466,62 @@ def _wtfismyip_com_ipv4(geo: bool, timeout: Union[float, Tuple[float, float]]
|
|
|
466
466
|
return {"status": False, "error": str(e)}
|
|
467
467
|
|
|
468
468
|
|
|
469
|
+
def _myip_wtf_ipv4(geo: bool, timeout: Union[float, Tuple[float, float]]
|
|
470
|
+
) -> Dict[str, Union[bool, Dict[str, Union[str, float]], str]]:
|
|
471
|
+
"""
|
|
472
|
+
Get public IP and geolocation using myip.wtf.
|
|
473
|
+
|
|
474
|
+
:param geo: geolocation flag
|
|
475
|
+
:param timeout: timeout value for API
|
|
476
|
+
"""
|
|
477
|
+
try:
|
|
478
|
+
data = _get_json_standard(url="https://json.ipv4.myip.wtf", timeout=timeout)
|
|
479
|
+
result = {"status": True, "data": {"ip": data["YourFuckingIPAddress"], "api": "myip.wtf"}}
|
|
480
|
+
if geo:
|
|
481
|
+
geo_data = {
|
|
482
|
+
"city": data.get("YourFuckingCity"),
|
|
483
|
+
"region": None,
|
|
484
|
+
"country": data.get("YourFuckingCountry"),
|
|
485
|
+
"country_code": data.get("YourFuckingCountryCode"),
|
|
486
|
+
"latitude": None,
|
|
487
|
+
"longitude": None,
|
|
488
|
+
"organization": data.get("YourFuckingISP"),
|
|
489
|
+
"timezone": None
|
|
490
|
+
}
|
|
491
|
+
result["data"].update(geo_data)
|
|
492
|
+
return result
|
|
493
|
+
except Exception as e:
|
|
494
|
+
return {"status": False, "error": str(e)}
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
def _db_ip_com_ipv4(geo: bool, timeout: Union[float, Tuple[float, float]]
|
|
498
|
+
) -> Dict[str, Union[bool, Dict[str, Union[str, float]], str]]:
|
|
499
|
+
"""
|
|
500
|
+
Get public IP and geolocation using db-ip.com.
|
|
501
|
+
|
|
502
|
+
:param geo: geolocation flag
|
|
503
|
+
:param timeout: timeout value for API
|
|
504
|
+
"""
|
|
505
|
+
try:
|
|
506
|
+
data = _get_json_force_ip(url="https://api.db-ip.com/v2/free/self", timeout=timeout, version="ipv4")
|
|
507
|
+
result = {"status": True, "data": {"ip": data["ipAddress"], "api": "db-ip.com"}}
|
|
508
|
+
if geo:
|
|
509
|
+
geo_data = {
|
|
510
|
+
"city": data.get("city"),
|
|
511
|
+
"region": data.get("stateProv"),
|
|
512
|
+
"country": data.get("countryName"),
|
|
513
|
+
"country_code": data.get("countryCode"),
|
|
514
|
+
"latitude": None, # not provided by free API
|
|
515
|
+
"longitude": None, # not provided by free API
|
|
516
|
+
"organization": None, # not provided by free API
|
|
517
|
+
"timezone": None # not provided by free API
|
|
518
|
+
}
|
|
519
|
+
result["data"].update(geo_data)
|
|
520
|
+
return result
|
|
521
|
+
except Exception as e:
|
|
522
|
+
return {"status": False, "error": str(e)}
|
|
523
|
+
|
|
524
|
+
|
|
469
525
|
IPV4_API_MAP = {
|
|
470
526
|
IPv4API.IFCONFIG_CO: {
|
|
471
527
|
"thread_safe": False,
|
|
@@ -542,11 +598,21 @@ IPV4_API_MAP = {
|
|
|
542
598
|
"geo": True,
|
|
543
599
|
"function": _wtfismyip_com_ipv4
|
|
544
600
|
},
|
|
601
|
+
IPv4API.MYIP_WTF: {
|
|
602
|
+
"thread_safe": True,
|
|
603
|
+
"geo": True,
|
|
604
|
+
"function": _myip_wtf_ipv4
|
|
605
|
+
},
|
|
606
|
+
IPv4API.DB_IP_COM: {
|
|
607
|
+
"thread_safe": False,
|
|
608
|
+
"geo": True,
|
|
609
|
+
"function": _db_ip_com_ipv4
|
|
610
|
+
},
|
|
545
611
|
}
|
|
546
612
|
|
|
547
613
|
|
|
548
|
-
def get_public_ipv4(api: IPv4API=IPv4API.AUTO_SAFE, geo: bool=False,
|
|
549
|
-
timeout: Union[float, Tuple[float, float]]=5,
|
|
614
|
+
def get_public_ipv4(api: IPv4API = IPv4API.AUTO_SAFE, geo: bool = False,
|
|
615
|
+
timeout: Union[float, Tuple[float, float]] = 5,
|
|
550
616
|
max_retries: int = 0,
|
|
551
617
|
retry_delay: float = 1.0,
|
|
552
618
|
backoff_factor: float = 1.0) -> Dict[str, Union[bool, Dict[str, Union[str, float]], str]]:
|
|
@@ -292,6 +292,62 @@ def _freeipapi_com_ipv6(geo: bool, timeout: Union[float, Tuple[float, float]]
|
|
|
292
292
|
return {"status": False, "error": str(e)}
|
|
293
293
|
|
|
294
294
|
|
|
295
|
+
def _wtfismyip_com_ipv6(geo: bool, timeout: Union[float, Tuple[float, float]]
|
|
296
|
+
) -> Dict[str, Union[bool, Dict[str, Union[str, float]], str]]:
|
|
297
|
+
"""
|
|
298
|
+
Get public IP and geolocation using wtfismyip.com.
|
|
299
|
+
|
|
300
|
+
:param geo: geolocation flag
|
|
301
|
+
:param timeout: timeout value for API
|
|
302
|
+
"""
|
|
303
|
+
try:
|
|
304
|
+
data = _get_json_standard(url="https://json.ipv6.wtfismyip.com", timeout=timeout)
|
|
305
|
+
result = {"status": True, "data": {"ip": data["YourFuckingIPAddress"], "api": "wtfismyip.com"}}
|
|
306
|
+
if geo:
|
|
307
|
+
geo_data = {
|
|
308
|
+
"city": data.get("YourFuckingCity"),
|
|
309
|
+
"region": None,
|
|
310
|
+
"country": data.get("YourFuckingCountry"),
|
|
311
|
+
"country_code": data.get("YourFuckingCountryCode"),
|
|
312
|
+
"latitude": None,
|
|
313
|
+
"longitude": None,
|
|
314
|
+
"organization": data.get("YourFuckingISP"),
|
|
315
|
+
"timezone": None
|
|
316
|
+
}
|
|
317
|
+
result["data"].update(geo_data)
|
|
318
|
+
return result
|
|
319
|
+
except Exception as e:
|
|
320
|
+
return {"status": False, "error": str(e)}
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def _myip_wtf_ipv6(geo: bool, timeout: Union[float, Tuple[float, float]]
|
|
324
|
+
) -> Dict[str, Union[bool, Dict[str, Union[str, float]], str]]:
|
|
325
|
+
"""
|
|
326
|
+
Get public IP and geolocation using myip.wtf.
|
|
327
|
+
|
|
328
|
+
:param geo: geolocation flag
|
|
329
|
+
:param timeout: timeout value for API
|
|
330
|
+
"""
|
|
331
|
+
try:
|
|
332
|
+
data = _get_json_standard(url="https://json.ipv6.myip.wtf", timeout=timeout)
|
|
333
|
+
result = {"status": True, "data": {"ip": data["YourFuckingIPAddress"], "api": "myip.wtf"}}
|
|
334
|
+
if geo:
|
|
335
|
+
geo_data = {
|
|
336
|
+
"city": data.get("YourFuckingCity"),
|
|
337
|
+
"region": None,
|
|
338
|
+
"country": data.get("YourFuckingCountry"),
|
|
339
|
+
"country_code": data.get("YourFuckingCountryCode"),
|
|
340
|
+
"latitude": None,
|
|
341
|
+
"longitude": None,
|
|
342
|
+
"organization": data.get("YourFuckingISP"),
|
|
343
|
+
"timezone": None
|
|
344
|
+
}
|
|
345
|
+
result["data"].update(geo_data)
|
|
346
|
+
return result
|
|
347
|
+
except Exception as e:
|
|
348
|
+
return {"status": False, "error": str(e)}
|
|
349
|
+
|
|
350
|
+
|
|
295
351
|
IPV6_API_MAP = {
|
|
296
352
|
IPv6API.IP_SB: {
|
|
297
353
|
"thread_safe": True,
|
|
@@ -337,12 +393,22 @@ IPV6_API_MAP = {
|
|
|
337
393
|
"thread_safe": False,
|
|
338
394
|
"geo": True,
|
|
339
395
|
"function": _freeipapi_com_ipv6
|
|
340
|
-
}
|
|
396
|
+
},
|
|
397
|
+
IPv6API.WTFISMYIP_COM: {
|
|
398
|
+
"thread_safe": True,
|
|
399
|
+
"geo": True,
|
|
400
|
+
"function": _wtfismyip_com_ipv6
|
|
401
|
+
},
|
|
402
|
+
IPv6API.MYIP_WTF: {
|
|
403
|
+
"thread_safe": True,
|
|
404
|
+
"geo": True,
|
|
405
|
+
"function": _myip_wtf_ipv6
|
|
406
|
+
},
|
|
341
407
|
}
|
|
342
408
|
|
|
343
409
|
|
|
344
|
-
def get_public_ipv6(api: IPv6API=IPv6API.AUTO_SAFE, geo: bool=False,
|
|
345
|
-
timeout: Union[float, Tuple[float, float]]=5,
|
|
410
|
+
def get_public_ipv6(api: IPv6API = IPv6API.AUTO_SAFE, geo: bool = False,
|
|
411
|
+
timeout: Union[float, Tuple[float, float]] = 5,
|
|
346
412
|
max_retries: int = 0,
|
|
347
413
|
retry_delay: float = 1.0,
|
|
348
414
|
backoff_factor: float = 1.0) -> Dict[str, Union[bool, Dict[str, Union[str, float]], str]]:
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"""ipspot params."""
|
|
3
3
|
from enum import Enum
|
|
4
4
|
|
|
5
|
-
IPSPOT_VERSION = "0.
|
|
5
|
+
IPSPOT_VERSION = "0.8"
|
|
6
6
|
|
|
7
7
|
IPSPOT_OVERVIEW = '''
|
|
8
|
-
IPSpot is a Python library for retrieving the current system's IP
|
|
9
|
-
It
|
|
10
|
-
|
|
8
|
+
IPSpot is a Python library for retrieving the current system's IP data and detailed location information such as region, longitude, and latitude.
|
|
9
|
+
It supports both public and private IPv4 and IPv6 detection through multiple API providers, using a fallback mechanism for improved reliability.
|
|
10
|
+
It has a simple and modular design, making it easy to perform fast IP, geolocation, provider, and regional lookups directly from your machine.
|
|
11
11
|
'''
|
|
12
12
|
|
|
13
13
|
IPSPOT_REPO = "https://github.com/openscilab/ipspot"
|
|
@@ -38,6 +38,8 @@ class IPv4API(Enum):
|
|
|
38
38
|
IPQUERY_IO = "ipquery.io"
|
|
39
39
|
IPWHO_IS = "ipwho.is"
|
|
40
40
|
WTFISMYIP_COM = "wtfismyip.com"
|
|
41
|
+
MYIP_WTF = "myip.wtf"
|
|
42
|
+
DB_IP_COM = "db-ip.com"
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
class IPv6API(Enum):
|
|
@@ -54,6 +56,8 @@ class IPv6API(Enum):
|
|
|
54
56
|
REALLYFREEGEOIP_ORG = "reallyfreegeoip.org"
|
|
55
57
|
MYIP_LA = "myip.la"
|
|
56
58
|
FREEIPAPI_COM = "freeipapi.com"
|
|
59
|
+
WTFISMYIP_COM = "wtfismyip.com"
|
|
60
|
+
MYIP_WTF = "myip.wtf"
|
|
57
61
|
|
|
58
62
|
|
|
59
63
|
PARAMETERS_NAME_MAP = {
|
|
@@ -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
|
|
@@ -51,7 +51,7 @@ Dynamic: summary
|
|
|
51
51
|
|
|
52
52
|
<div align="center">
|
|
53
53
|
<img src="https://github.com/openscilab/ipspot/raw/main/otherfiles/logo.png" width="350">
|
|
54
|
-
<h1>IPSpot:
|
|
54
|
+
<h1>IPSpot: Retrieve IPv4/IPv6 Addresses with Geolocation Data</h1>
|
|
55
55
|
<br/>
|
|
56
56
|
<a href="https://codecov.io/gh/openscilab/ipspot"><img src="https://codecov.io/gh/openscilab/ipspot/graph/badge.svg?token=XCFKASULS8"></a>
|
|
57
57
|
<a href="https://badge.fury.io/py/ipspot"><img src="https://badge.fury.io/py/ipspot.svg" alt="PyPI version"></a>
|
|
@@ -63,7 +63,7 @@ Dynamic: summary
|
|
|
63
63
|
## Overview
|
|
64
64
|
|
|
65
65
|
<p align="justify">
|
|
66
|
-
<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.
|
|
67
67
|
</p>
|
|
68
68
|
|
|
69
69
|
<table>
|
|
@@ -104,13 +104,13 @@ Dynamic: summary
|
|
|
104
104
|
## Installation
|
|
105
105
|
|
|
106
106
|
### Source Code
|
|
107
|
-
- 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)
|
|
108
108
|
- `pip install .`
|
|
109
109
|
|
|
110
110
|
### PyPI
|
|
111
111
|
|
|
112
112
|
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
|
|
113
|
-
- `pip install ipspot==0.
|
|
113
|
+
- `pip install ipspot==0.8`
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
## Usage
|
|
@@ -166,7 +166,7 @@ Dynamic: summary
|
|
|
166
166
|
```console
|
|
167
167
|
> ipspot --version
|
|
168
168
|
|
|
169
|
-
0.
|
|
169
|
+
0.8
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
#### Info
|
|
@@ -181,17 +181,17 @@ Dynamic: summary
|
|
|
181
181
|
|___||_| |____/ | .__/ \___/ \__|
|
|
182
182
|
|_|
|
|
183
183
|
|
|
184
|
-
__ __ ___
|
|
185
|
-
\ \ / / _ / _ \
|
|
186
|
-
\ \ / / (_)| | | |
|
|
187
|
-
\ V / _ | |_| | _
|
|
188
|
-
\_/ (_) \___/ (_) /
|
|
184
|
+
__ __ ___ ___
|
|
185
|
+
\ \ / / _ / _ \ ( _ )
|
|
186
|
+
\ \ / / (_)| | | | / _ \
|
|
187
|
+
\ V / _ | |_| | _ | (_) |
|
|
188
|
+
\_/ (_) \___/ (_) \___/
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
|
|
192
|
-
IPSpot is a Python library for retrieving the current system's IP
|
|
193
|
-
It
|
|
194
|
-
|
|
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.
|
|
195
195
|
|
|
196
196
|
Repo : https://github.com/openscilab/ipspot
|
|
197
197
|
|
|
@@ -238,7 +238,7 @@ Public IP and Location Info:
|
|
|
238
238
|
|
|
239
239
|
#### IPv4 API
|
|
240
240
|
|
|
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`]
|
|
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`]
|
|
242
242
|
|
|
243
243
|
ℹ️ The default value: `auto-safe`
|
|
244
244
|
|
|
@@ -281,7 +281,7 @@ Public IP and Location Info:
|
|
|
281
281
|
|
|
282
282
|
#### IPv6 API
|
|
283
283
|
|
|
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`]
|
|
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`]
|
|
285
285
|
|
|
286
286
|
ℹ️ The default value: `auto-safe`
|
|
287
287
|
|
|
@@ -377,6 +377,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
377
377
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
378
378
|
|
|
379
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
|
|
380
388
|
## [0.7] - 2025-12-09
|
|
381
389
|
### Added
|
|
382
390
|
- `--backoff-factor` argument
|
|
@@ -480,7 +488,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
480
488
|
- `--no-geo` argument
|
|
481
489
|
- Logo
|
|
482
490
|
|
|
483
|
-
[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
|
|
484
493
|
[0.7]: https://github.com/openscilab/ipspot/compare/v0.6...v0.7
|
|
485
494
|
[0.6]: https://github.com/openscilab/ipspot/compare/v0.5...v0.6
|
|
486
495
|
[0.5]: https://github.com/openscilab/ipspot/compare/v0.4...v0.5
|
|
@@ -24,24 +24,24 @@ def read_description() -> str:
|
|
|
24
24
|
description += c.read()
|
|
25
25
|
return description
|
|
26
26
|
except Exception:
|
|
27
|
-
return '''IPSpot is a Python library for retrieving the current system's IP
|
|
28
|
-
It
|
|
29
|
-
|
|
27
|
+
return '''IPSpot is a Python library for retrieving the current system's IP data and detailed location information such as region, longitude, and latitude.
|
|
28
|
+
It supports both public and private IPv4 and IPv6 detection through multiple API providers, using a fallback mechanism for improved reliability.
|
|
29
|
+
It has a simple and modular design, making it easy to perform fast IP, geolocation, provider, and regional lookups directly from your machine.'''
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
setup(
|
|
33
33
|
name='ipspot',
|
|
34
34
|
packages=['ipspot'],
|
|
35
|
-
version='0.
|
|
36
|
-
description='IPSpot:
|
|
35
|
+
version='0.8',
|
|
36
|
+
description='IPSpot: Retrieve IPv4/IPv6 Addresses with Geolocation Data',
|
|
37
37
|
long_description=read_description(),
|
|
38
38
|
long_description_content_type='text/markdown',
|
|
39
39
|
include_package_data=True,
|
|
40
40
|
author='IPSpot Development Team',
|
|
41
41
|
author_email='ipspot@openscilab.com',
|
|
42
42
|
url='https://github.com/openscilab/ipspot',
|
|
43
|
-
download_url='https://github.com/openscilab/ipspot/tarball/v0.
|
|
44
|
-
keywords="ip ipv4 geo geolocation network location ipspot cli",
|
|
43
|
+
download_url='https://github.com/openscilab/ipspot/tarball/v0.8',
|
|
44
|
+
keywords="ip ipv4 ipv6 geo geolocation network location ipspot cli",
|
|
45
45
|
project_urls={
|
|
46
46
|
'Source': 'https://github.com/openscilab/ipspot'
|
|
47
47
|
},
|
|
@@ -137,3 +137,19 @@ def test_public_ipv4_wtfismyip_com_success():
|
|
|
137
137
|
assert is_ipv4(result["data"]["ip"])
|
|
138
138
|
assert set(result["data"].keys()) == DATA_ITEMS
|
|
139
139
|
assert result["data"]["api"] == "wtfismyip.com"
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def test_public_ipv4_myip_wtf_success():
|
|
143
|
+
result = get_public_ipv4(api=IPv4API.MYIP_WTF, geo=True, timeout=40, max_retries=4, retry_delay=90, backoff_factor=1.1)
|
|
144
|
+
assert result["status"]
|
|
145
|
+
assert is_ipv4(result["data"]["ip"])
|
|
146
|
+
assert set(result["data"].keys()) == DATA_ITEMS
|
|
147
|
+
assert result["data"]["api"] == "myip.wtf"
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def test_public_ipv4_db_ip_com_success():
|
|
151
|
+
result = get_public_ipv4(api=IPv4API.DB_IP_COM, geo=True, timeout=40, max_retries=4, retry_delay=90, backoff_factor=1.1)
|
|
152
|
+
assert result["status"]
|
|
153
|
+
assert is_ipv4(result["data"]["ip"])
|
|
154
|
+
assert set(result["data"].keys()) == DATA_ITEMS
|
|
155
|
+
assert result["data"]["api"] == "db-ip.com"
|
|
@@ -75,9 +75,6 @@ def test_get_private_ipv4_exception():
|
|
|
75
75
|
assert result["error"] == "Test error"
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
78
|
def test_public_ipv4_auto_timeout_error():
|
|
82
79
|
result = get_public_ipv4(api=IPv4API.AUTO, geo=True, timeout="5")
|
|
83
80
|
assert not result["status"]
|
|
@@ -90,9 +87,6 @@ def test_public_ipv4_auto_net_error():
|
|
|
90
87
|
assert result["error"] == "All attempts failed."
|
|
91
88
|
|
|
92
89
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
90
|
def test_public_ipv4_auto_safe_timeout_error():
|
|
97
91
|
result = get_public_ipv4(api=IPv4API.AUTO_SAFE, geo=True, timeout="5")
|
|
98
92
|
assert not result["status"]
|
|
@@ -105,9 +99,6 @@ def test_public_ipv4_auto_safe_net_error():
|
|
|
105
99
|
assert result["error"] == "All attempts failed."
|
|
106
100
|
|
|
107
101
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
102
|
def test_public_ipv4_ipapi_co_timeout_error():
|
|
112
103
|
result = get_public_ipv4(api=IPv4API.IPAPI_CO, geo=True, timeout="5")
|
|
113
104
|
assert not result["status"]
|
|
@@ -120,9 +111,6 @@ def test_public_ipv4_ipapi_co_net_error():
|
|
|
120
111
|
assert result["error"] == "No Internet"
|
|
121
112
|
|
|
122
113
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
114
|
def test_public_ipv4_ipleak_net_timeout_error():
|
|
127
115
|
result = get_public_ipv4(api=IPv4API.IPLEAK_NET, geo=True, timeout="5")
|
|
128
116
|
assert not result["status"]
|
|
@@ -135,9 +123,6 @@ def test_public_ipv4_ipleak_net_net_error():
|
|
|
135
123
|
assert result["error"] == "No Internet"
|
|
136
124
|
|
|
137
125
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
126
|
def test_public_ipv4_my_ip_io_timeout_error():
|
|
142
127
|
result = get_public_ipv4(api=IPv4API.MY_IP_IO, geo=True, timeout="5")
|
|
143
128
|
assert not result["status"]
|
|
@@ -150,9 +135,6 @@ def test_public_ipv4_my_ip_io_net_error():
|
|
|
150
135
|
assert result["error"] == "No Internet"
|
|
151
136
|
|
|
152
137
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
138
|
def test_public_ipv4_ifconfig_co_timeout_error():
|
|
157
139
|
result = get_public_ipv4(api=IPv4API.IFCONFIG_CO, geo=True, timeout="5")
|
|
158
140
|
assert not result["status"]
|
|
@@ -165,9 +147,6 @@ def test_public_ipv4_ifconfig_co_net_error():
|
|
|
165
147
|
assert result["error"] == "No Internet"
|
|
166
148
|
|
|
167
149
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
150
|
def test_public_ipv4_myip_la_timeout_error():
|
|
172
151
|
result = get_public_ipv4(api=IPv4API.MYIP_LA, geo=True, timeout="5")
|
|
173
152
|
assert not result["status"]
|
|
@@ -180,9 +159,6 @@ def test_public_ipv4_myip_la_net_error():
|
|
|
180
159
|
assert result["error"] == "No Internet"
|
|
181
160
|
|
|
182
161
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
162
|
def test_public_ipv4_ipquery_io_timeout_error():
|
|
187
163
|
result = get_public_ipv4(api=IPv4API.IPQUERY_IO, geo=True, timeout="5")
|
|
188
164
|
assert not result["status"]
|
|
@@ -195,9 +171,6 @@ def test_public_ipv4_ipquery_io_net_error():
|
|
|
195
171
|
assert result["error"] == "No Internet"
|
|
196
172
|
|
|
197
173
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
174
|
def test_public_ipv4_ipwho_is_timeout_error():
|
|
202
175
|
result = get_public_ipv4(api=IPv4API.IPWHO_IS, geo=True, timeout="5")
|
|
203
176
|
assert not result["status"]
|
|
@@ -210,9 +183,6 @@ def test_public_ipv4_ipwho_is_net_error():
|
|
|
210
183
|
assert result["error"] == "No Internet"
|
|
211
184
|
|
|
212
185
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
186
|
def test_public_ipv4_freeipapi_com_timeout_error():
|
|
217
187
|
result = get_public_ipv4(api=IPv4API.FREEIPAPI_COM, geo=True, timeout="5")
|
|
218
188
|
assert not result["status"]
|
|
@@ -225,9 +195,6 @@ def test_public_ipv4_freeipapi_com_net_error():
|
|
|
225
195
|
assert result["error"] == "No Internet"
|
|
226
196
|
|
|
227
197
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
198
|
def test_public_ipv4_ip_api_com_timeout_error():
|
|
232
199
|
result = get_public_ipv4(api=IPv4API.IP_API_COM, geo=True, timeout="5")
|
|
233
200
|
assert not result["status"]
|
|
@@ -240,9 +207,6 @@ def test_public_ipv4_ip_api_com_net_error():
|
|
|
240
207
|
assert result["error"] == "No Internet"
|
|
241
208
|
|
|
242
209
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
210
|
def test_public_ipv4_ipinfo_io_timeout_error():
|
|
247
211
|
result = get_public_ipv4(api=IPv4API.IPINFO_IO, geo=True, timeout="5")
|
|
248
212
|
assert not result["status"]
|
|
@@ -255,15 +219,11 @@ def test_public_ipv4_ipinfo_io_net_error():
|
|
|
255
219
|
assert result["error"] == "No Internet"
|
|
256
220
|
|
|
257
221
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
222
|
def test_public_ipv4_ip_sb_timeout_error():
|
|
262
223
|
result = get_public_ipv4(api=IPv4API.IP_SB, geo=True, timeout="5")
|
|
263
224
|
assert not result["status"]
|
|
264
225
|
|
|
265
226
|
|
|
266
|
-
|
|
267
227
|
def test_public_ipv4_ip_sb_net_error():
|
|
268
228
|
with mock.patch.object(requests.Session, "get", side_effect=Exception("No Internet")):
|
|
269
229
|
result = get_public_ipv4(api=IPv4API.IP_SB)
|
|
@@ -271,9 +231,6 @@ def test_public_ipv4_ip_sb_net_error():
|
|
|
271
231
|
assert result["error"] == "No Internet"
|
|
272
232
|
|
|
273
233
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
234
|
def test_public_ipv4_ident_me_timeout_error():
|
|
278
235
|
result = get_public_ipv4(api=IPv4API.IDENT_ME, geo=True, timeout="5")
|
|
279
236
|
assert not result["status"]
|
|
@@ -286,9 +243,6 @@ def test_public_ipv4_ident_me_net_error():
|
|
|
286
243
|
assert result["error"] == "No Internet"
|
|
287
244
|
|
|
288
245
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
246
|
def test_public_ipv4_tnedi_me_timeout_error():
|
|
293
247
|
result = get_public_ipv4(api=IPv4API.TNEDI_ME, geo=True, timeout="5")
|
|
294
248
|
assert not result["status"]
|
|
@@ -307,9 +261,6 @@ def test_public_ipv4_api_error():
|
|
|
307
261
|
assert result["error"] == "Unsupported API: api1"
|
|
308
262
|
|
|
309
263
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
264
|
def test_public_ipv4_reallyfreegeoip_org_timeout_error():
|
|
314
265
|
result = get_public_ipv4(api=IPv4API.REALLYFREEGEOIP_ORG, geo=True, timeout="5")
|
|
315
266
|
assert not result["status"]
|
|
@@ -322,8 +273,6 @@ def test_public_ipv4_reallyfreegeoip_org_net_error():
|
|
|
322
273
|
assert result["error"] == "No Internet"
|
|
323
274
|
|
|
324
275
|
|
|
325
|
-
|
|
326
|
-
|
|
327
276
|
def test_public_ipv4_wtfismyip_com_timeout_error():
|
|
328
277
|
result = get_public_ipv4(api=IPv4API.WTFISMYIP_COM, geo=True, timeout="5")
|
|
329
278
|
assert not result["status"]
|
|
@@ -334,3 +283,15 @@ def test_public_ipv4_wtfismyip_com_net_error():
|
|
|
334
283
|
result = get_public_ipv4(api=IPv4API.WTFISMYIP_COM)
|
|
335
284
|
assert not result["status"]
|
|
336
285
|
assert result["error"] == "No Internet"
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def test_public_ipv4_db_ip_com_timeout_error():
|
|
289
|
+
result = get_public_ipv4(api=IPv4API.DB_IP_COM, geo=True, timeout="5")
|
|
290
|
+
assert not result["status"]
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def test_public_ipv4_db_ip_com_net_error():
|
|
294
|
+
with mock.patch.object(requests.Session, "get", side_effect=Exception("No Internet")):
|
|
295
|
+
result = get_public_ipv4(api=IPv4API.DB_IP_COM)
|
|
296
|
+
assert not result["status"]
|
|
297
|
+
assert result["error"] == "No Internet"
|
|
@@ -76,6 +76,14 @@ def test_public_freeipapi_com_success():
|
|
|
76
76
|
assert result["data"]["api"] == "freeipapi.com"
|
|
77
77
|
|
|
78
78
|
|
|
79
|
+
def test_public_ipv6_wtfismyip_com_success():
|
|
80
|
+
result = get_public_ipv6(api=IPv6API.WTFISMYIP_COM, geo=True, timeout=40, max_retries=4, retry_delay=90, backoff_factor=1.1)
|
|
81
|
+
assert result["status"]
|
|
82
|
+
assert is_ipv6(result["data"]["ip"])
|
|
83
|
+
assert set(result["data"].keys()) == DATA_ITEMS
|
|
84
|
+
assert result["data"]["api"] == "wtfismyip.com"
|
|
85
|
+
|
|
86
|
+
|
|
79
87
|
def test_public_ipv6_auto_success():
|
|
80
88
|
result = get_public_ipv6(api=IPv6API.AUTO, geo=True, timeout=40, max_retries=4, retry_delay=90, backoff_factor=1.1)
|
|
81
89
|
assert result["status"]
|
|
@@ -87,4 +95,12 @@ def test_public_ipv6_auto_safe_success():
|
|
|
87
95
|
result = get_public_ipv6(api=IPv6API.AUTO_SAFE, geo=True, timeout=40, max_retries=4, retry_delay=90, backoff_factor=1.1)
|
|
88
96
|
assert result["status"]
|
|
89
97
|
assert is_ipv6(result["data"]["ip"])
|
|
90
|
-
assert set(result["data"].keys()) == DATA_ITEMS
|
|
98
|
+
assert set(result["data"].keys()) == DATA_ITEMS
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def test_public_ipv6_myip_wtf_success():
|
|
102
|
+
result = get_public_ipv6(api=IPv6API.MYIP_WTF, geo=True, timeout=40, max_retries=4, retry_delay=90, backoff_factor=1.1)
|
|
103
|
+
assert result["status"]
|
|
104
|
+
assert is_ipv6(result["data"]["ip"])
|
|
105
|
+
assert set(result["data"].keys()) == DATA_ITEMS
|
|
106
|
+
assert result["data"]["api"] == "myip.wtf"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|