ipspot 0.7__py3-none-any.whl → 0.8__py3-none-any.whl

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/ipv4.py CHANGED
@@ -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]]:
ipspot/ipv6.py CHANGED
@@ -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]]:
ipspot/params.py CHANGED
@@ -2,12 +2,12 @@
2
2
  """ipspot params."""
3
3
  from enum import Enum
4
4
 
5
- IPSPOT_VERSION = "0.7"
5
+ IPSPOT_VERSION = "0.8"
6
6
 
7
7
  IPSPOT_OVERVIEW = '''
8
- IPSpot is a Python library for retrieving the current system's IP address and location information.
9
- It currently supports public and private IPv4 detection using multiple API providers with a fallback mechanism for reliability.
10
- Designed with simplicity and modularity in mind, IPSpot offers quick IP and geolocation lookups directly from your machine.
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.7
4
- Summary: IPSpot: A Python Tool to Fetch the System's IP Address
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.7
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: A Python Tool to Fetch the System's IP Address</h1>
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 address and location information. It currently supports public and private <b>IPv4</b> detection using multiple API providers with a fallback mechanism for reliability. Designed with simplicity and modularity in mind, <b>IPSpot</b> offers quick IP and geolocation lookups directly from your machine.
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.7](https://github.com/openscilab/ipspot/archive/v0.7.zip) or [Latest Source](https://github.com/openscilab/ipspot/archive/dev.zip)
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.7`
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.7
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 address and location information.
193
- It currently supports public and private IPv4 detection using multiple API providers with a fallback mechanism for reliability.
194
- Designed with simplicity and modularity in mind, IPSpot offers quick IP and geolocation lookups directly from your machine.
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.7...dev
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
@@ -0,0 +1,14 @@
1
+ ipspot/__init__.py,sha256=B47uAOAidLkXps1A4zDig6NN2kB3HcdMC20UOrrEfB4,281
2
+ ipspot/__main__.py,sha256=xKHY_tc94SWktkIHV0O9YADAHPZvT8yXOFSm_L2yMno,105
3
+ ipspot/cli.py,sha256=Y48HA_s6SrTCtjn-iAFNMplAARLwBUx8zpxesG0hARE,4980
4
+ ipspot/ipv4.py,sha256=QPTigPv5bIHX2FkCTZnnuq5-X4_i3_xRlk6d3U6VgfQ,24079
5
+ ipspot/ipv6.py,sha256=wKEOcfGA-y-nuygU9KhqzULzRejEqZ5Dfr_mjHndEoA,16485
6
+ ipspot/params.py,sha256=-j5WYVCWfa_Qdub5q8CELl1S8tq2wg7NbWbW4ilfE9o,2340
7
+ ipspot/utils.py,sha256=W3HJ61_KVtdg4gWr4m9xXblQc_E30rJoF1aKk36Zqzg,4591
8
+ ipspot-0.8.dist-info/licenses/AUTHORS.md,sha256=5ZvxP1KnuVkurB4psQDSqnqiAyn44q1aeiXUsnYgps4,411
9
+ ipspot-0.8.dist-info/licenses/LICENSE,sha256=0aOd4wzZRoSH_35UZXRHS7alPFTtuFEBJrajLuonEIw,1067
10
+ ipspot-0.8.dist-info/METADATA,sha256=QG5WjBJEl7Iz0V2MlmB5G0l_xreUHx79A_ApdrAEPVM,15986
11
+ ipspot-0.8.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
+ ipspot-0.8.dist-info/entry_points.txt,sha256=DJVLepYr8H3UcvWekU5Jy-tcr_xmWrphzgWGNOd3hlk,43
13
+ ipspot-0.8.dist-info/top_level.txt,sha256=v0WgE1z2iCy_bXU53fVcllwHLTvGNBIvq8u3KPC2_Sc,7
14
+ ipspot-0.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,14 +0,0 @@
1
- ipspot/__init__.py,sha256=B47uAOAidLkXps1A4zDig6NN2kB3HcdMC20UOrrEfB4,281
2
- ipspot/__main__.py,sha256=xKHY_tc94SWktkIHV0O9YADAHPZvT8yXOFSm_L2yMno,105
3
- ipspot/cli.py,sha256=Y48HA_s6SrTCtjn-iAFNMplAARLwBUx8zpxesG0hARE,4980
4
- ipspot/ipv4.py,sha256=QGeVZWruziLwe0bxtvo7k0xrnY73-znsXtSsvELYdyE,21613
5
- ipspot/ipv6.py,sha256=xkgKyTSP_3TTijeM0BftiKL1KlIqMtRucb16-2QrkzA,14081
6
- ipspot/params.py,sha256=u8eEDVB40Fo52DRhD7-mPg30U62Brtc2aGi9ZhqYuC8,2142
7
- ipspot/utils.py,sha256=W3HJ61_KVtdg4gWr4m9xXblQc_E30rJoF1aKk36Zqzg,4591
8
- ipspot-0.7.dist-info/licenses/AUTHORS.md,sha256=5ZvxP1KnuVkurB4psQDSqnqiAyn44q1aeiXUsnYgps4,411
9
- ipspot-0.7.dist-info/licenses/LICENSE,sha256=0aOd4wzZRoSH_35UZXRHS7alPFTtuFEBJrajLuonEIw,1067
10
- ipspot-0.7.dist-info/METADATA,sha256=P0uWs_6IZgVWPXJd53rsfvrepgJwLUq7Y8v_FNTDzB0,15395
11
- ipspot-0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- ipspot-0.7.dist-info/entry_points.txt,sha256=DJVLepYr8H3UcvWekU5Jy-tcr_xmWrphzgWGNOd3hlk,43
13
- ipspot-0.7.dist-info/top_level.txt,sha256=v0WgE1z2iCy_bXU53fVcllwHLTvGNBIvq8u3KPC2_Sc,7
14
- ipspot-0.7.dist-info/RECORD,,