tldextract 5.1.1__py3-none-any.whl → 5.1.2__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.
- tldextract/__main__.py +0 -1
- tldextract/_version.py +2 -2
- tldextract/cache.py +3 -4
- tldextract/remote.py +6 -28
- tldextract/tldextract.py +5 -10
- {tldextract-5.1.1.dist-info → tldextract-5.1.2.dist-info}/LICENSE +1 -1
- {tldextract-5.1.1.dist-info → tldextract-5.1.2.dist-info}/METADATA +5 -1
- tldextract-5.1.2.dist-info/RECORD +16 -0
- {tldextract-5.1.1.dist-info → tldextract-5.1.2.dist-info}/WHEEL +1 -1
- tldextract-5.1.1.dist-info/RECORD +0 -16
- {tldextract-5.1.1.dist-info → tldextract-5.1.2.dist-info}/entry_points.txt +0 -0
- {tldextract-5.1.1.dist-info → tldextract-5.1.2.dist-info}/top_level.txt +0 -0
tldextract/__main__.py
CHANGED
tldextract/_version.py
CHANGED
tldextract/cache.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Helpers."""
|
2
|
+
|
2
3
|
from __future__ import annotations
|
3
4
|
|
4
5
|
import errno
|
@@ -37,8 +38,7 @@ else:
|
|
37
38
|
|
38
39
|
|
39
40
|
def get_pkg_unique_identifier() -> str:
|
40
|
-
"""
|
41
|
-
Generate an identifier unique to the python version, tldextract version, and python instance.
|
41
|
+
"""Generate an identifier unique to the python version, tldextract version, and python instance.
|
42
42
|
|
43
43
|
This will prevent interference between virtualenvs and issues that might arise when installing
|
44
44
|
a new version of tldextract
|
@@ -65,8 +65,7 @@ def get_pkg_unique_identifier() -> str:
|
|
65
65
|
|
66
66
|
|
67
67
|
def get_cache_dir() -> str:
|
68
|
-
"""
|
69
|
-
Get a cache dir that we have permission to write to.
|
68
|
+
"""Get a cache dir that we have permission to write to.
|
70
69
|
|
71
70
|
Try to follow the XDG standard, but if that doesn't work fallback to the package directory
|
72
71
|
http://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
tldextract/remote.py
CHANGED
@@ -3,19 +3,13 @@
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
5
|
import re
|
6
|
-
from collections.abc import Callable
|
7
6
|
from ipaddress import AddressValueError, IPv6Address
|
8
7
|
from urllib.parse import scheme_chars
|
9
8
|
|
10
|
-
inet_pton: Callable[[int, str], bytes] | None
|
11
|
-
try:
|
12
|
-
from socket import AF_INET, AF_INET6, inet_pton # Availability: Unix, Windows.
|
13
|
-
except ImportError:
|
14
|
-
inet_pton = None
|
15
|
-
|
16
9
|
IP_RE = re.compile(
|
17
|
-
r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)"
|
18
|
-
r"{3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
|
10
|
+
r"^(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.)"
|
11
|
+
r"{3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
|
12
|
+
re.ASCII,
|
19
13
|
)
|
20
14
|
|
21
15
|
scheme_chars_set = set(scheme_chars)
|
@@ -59,32 +53,16 @@ def _schemeless_url(url: str) -> str:
|
|
59
53
|
return url[double_slashes_start + 2 :]
|
60
54
|
|
61
55
|
|
62
|
-
def looks_like_ip(
|
63
|
-
|
64
|
-
) -> bool:
|
65
|
-
"""Check whether the given str looks like an IP address."""
|
56
|
+
def looks_like_ip(maybe_ip: str) -> bool:
|
57
|
+
"""Check whether the given str looks like an IPv4 address."""
|
66
58
|
if not maybe_ip[0].isdigit():
|
67
59
|
return False
|
68
60
|
|
69
|
-
if pton is not None:
|
70
|
-
try:
|
71
|
-
pton(AF_INET, maybe_ip)
|
72
|
-
return True
|
73
|
-
except OSError:
|
74
|
-
return False
|
75
61
|
return IP_RE.fullmatch(maybe_ip) is not None
|
76
62
|
|
77
63
|
|
78
|
-
def looks_like_ipv6(
|
79
|
-
maybe_ip: str, pton: Callable[[int, str], bytes] | None = inet_pton
|
80
|
-
) -> bool:
|
64
|
+
def looks_like_ipv6(maybe_ip: str) -> bool:
|
81
65
|
"""Check whether the given str looks like an IPv6 address."""
|
82
|
-
if pton is not None:
|
83
|
-
try:
|
84
|
-
pton(AF_INET6, maybe_ip)
|
85
|
-
return True
|
86
|
-
except OSError:
|
87
|
-
return False
|
88
66
|
try:
|
89
67
|
IPv6Address(maybe_ip)
|
90
68
|
except AddressValueError:
|
tldextract/tldextract.py
CHANGED
@@ -75,8 +75,7 @@ class ExtractResult:
|
|
75
75
|
|
76
76
|
@property
|
77
77
|
def registered_domain(self) -> str:
|
78
|
-
"""
|
79
|
-
Joins the domain and suffix fields with a dot, if they're both set.
|
78
|
+
"""Joins the domain and suffix fields with a dot, if they're both set.
|
80
79
|
|
81
80
|
>>> extract('http://forums.bbc.co.uk').registered_domain
|
82
81
|
'bbc.co.uk'
|
@@ -89,8 +88,7 @@ class ExtractResult:
|
|
89
88
|
|
90
89
|
@property
|
91
90
|
def fqdn(self) -> str:
|
92
|
-
"""
|
93
|
-
Returns a Fully Qualified Domain Name, if there is a proper domain/suffix.
|
91
|
+
"""Returns a Fully Qualified Domain Name, if there is a proper domain/suffix.
|
94
92
|
|
95
93
|
>>> extract('http://forums.bbc.co.uk/path/to/file').fqdn
|
96
94
|
'forums.bbc.co.uk'
|
@@ -103,8 +101,7 @@ class ExtractResult:
|
|
103
101
|
|
104
102
|
@property
|
105
103
|
def ipv4(self) -> str:
|
106
|
-
"""
|
107
|
-
Returns the ipv4 if that is what the presented domain/url is.
|
104
|
+
"""Returns the ipv4 if that is what the presented domain/url is.
|
108
105
|
|
109
106
|
>>> extract('http://127.0.0.1/path/to/file').ipv4
|
110
107
|
'127.0.0.1'
|
@@ -123,8 +120,7 @@ class ExtractResult:
|
|
123
120
|
|
124
121
|
@property
|
125
122
|
def ipv6(self) -> str:
|
126
|
-
"""
|
127
|
-
Returns the ipv6 if that is what the presented domain/url is.
|
123
|
+
"""Returns the ipv6 if that is what the presented domain/url is.
|
128
124
|
|
129
125
|
>>> extract('http://[aBcD:ef01:2345:6789:aBcD:ef01:127.0.0.1]/path/to/file').ipv6
|
130
126
|
'aBcD:ef01:2345:6789:aBcD:ef01:127.0.0.1'
|
@@ -334,8 +330,7 @@ class TLDExtract:
|
|
334
330
|
|
335
331
|
@property
|
336
332
|
def tlds(self, session: requests.Session | None = None) -> list[str]:
|
337
|
-
"""
|
338
|
-
Returns the list of tld's used by default.
|
333
|
+
"""Returns the list of tld's used by default.
|
339
334
|
|
340
335
|
This will vary based on `include_psl_private_domains` and `extra_suffixes`
|
341
336
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tldextract
|
3
|
-
Version: 5.1.
|
3
|
+
Version: 5.1.2
|
4
4
|
Summary: Accurately separates a URL's subdomain, domain, and public suffix, using the Public Suffix List (PSL). By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well.
|
5
5
|
Author-email: John Kurkowski <john.kurkowski@gmail.com>
|
6
6
|
License: BSD-3-Clause
|
@@ -22,6 +22,9 @@ Requires-Dist: idna
|
|
22
22
|
Requires-Dist: requests >=2.1.0
|
23
23
|
Requires-Dist: requests-file >=1.4
|
24
24
|
Requires-Dist: filelock >=3.0.8
|
25
|
+
Provides-Extra: release
|
26
|
+
Requires-Dist: build ; extra == 'release'
|
27
|
+
Requires-Dist: twine ; extra == 'release'
|
25
28
|
Provides-Extra: testing
|
26
29
|
Requires-Dist: black ; extra == 'testing'
|
27
30
|
Requires-Dist: mypy ; extra == 'testing'
|
@@ -30,6 +33,7 @@ Requires-Dist: pytest-gitignore ; extra == 'testing'
|
|
30
33
|
Requires-Dist: pytest-mock ; extra == 'testing'
|
31
34
|
Requires-Dist: responses ; extra == 'testing'
|
32
35
|
Requires-Dist: ruff ; extra == 'testing'
|
36
|
+
Requires-Dist: syrupy ; extra == 'testing'
|
33
37
|
Requires-Dist: tox ; extra == 'testing'
|
34
38
|
Requires-Dist: types-filelock ; extra == 'testing'
|
35
39
|
Requires-Dist: types-requests ; extra == 'testing'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
tldextract/.tld_set_snapshot,sha256=TVya0bCcmRKl_16oPKPIlNmWS09rXrjOKGgYjhvAGLE,238022
|
2
|
+
tldextract/__init__.py,sha256=rZg3DKzS9CTARuF4Tuq50ViILwUktDED89Av8nStNuM,216
|
3
|
+
tldextract/__main__.py,sha256=oiZ5EW_lxRLH6Khk6MdzXf7a1Ld5-A3k4wOFRmNNk2o,89
|
4
|
+
tldextract/_version.py,sha256=iJQJoAO8HGnLsPBpH1rkF4KPbrYxIqs4qAXfUgzhRqQ,411
|
5
|
+
tldextract/cache.py,sha256=vsr4ERgNxmBO_mYwXLCMbRRKq1s-IDZZLXoaGIYXmBM,8601
|
6
|
+
tldextract/cli.py,sha256=nCzBAFrgAopTK1t5eBRQgeveSgWheUx4LAlAHE_8mzQ,3010
|
7
|
+
tldextract/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
+
tldextract/remote.py,sha256=sklRFbATwPs_S33-KeIu9ixuSWP5w7QXO8jnhi_lgJs,1944
|
9
|
+
tldextract/suffix_list.py,sha256=TcUpMTZwsicZn6_eHKqA4bjurQrKYde14P-4HT4s4yE,3896
|
10
|
+
tldextract/tldextract.py,sha256=oUYLJcgWmeika0teDq2nNI5UCSbAR0c3eosYslVJPUY,18731
|
11
|
+
tldextract-5.1.2.dist-info/LICENSE,sha256=dKIruBYZ9wJFoTWv8hvg2bhDv9TXDQ82u-0EERuGJYg,1527
|
12
|
+
tldextract-5.1.2.dist-info/METADATA,sha256=dkiY2wl_8M2guJ0MGhGi0YQ9OgZI4vGpJ0I9LMLSGyQ,11464
|
13
|
+
tldextract-5.1.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
14
|
+
tldextract-5.1.2.dist-info/entry_points.txt,sha256=EStkXC80BetCMp1UDhU3kWuXBo3qDpgKltZTJ1x4x1U,51
|
15
|
+
tldextract-5.1.2.dist-info/top_level.txt,sha256=DWZIjV49WP30tyC1KOEP7t-EaS4IRCXQzc0KXAOn_bk,11
|
16
|
+
tldextract-5.1.2.dist-info/RECORD,,
|
@@ -1,16 +0,0 @@
|
|
1
|
-
tldextract/.tld_set_snapshot,sha256=TVya0bCcmRKl_16oPKPIlNmWS09rXrjOKGgYjhvAGLE,238022
|
2
|
-
tldextract/__init__.py,sha256=rZg3DKzS9CTARuF4Tuq50ViILwUktDED89Av8nStNuM,216
|
3
|
-
tldextract/__main__.py,sha256=FxfCNOozXSaJP2GTjgWLAn03oNMd_EUUOWkfT1_YRgM,90
|
4
|
-
tldextract/_version.py,sha256=4EdDKGM6Iho6lM78lQ9aYNVSDF9h4ZKreOI56ih8gfs,411
|
5
|
-
tldextract/cache.py,sha256=T2yLSHh_UheJd6VqHPkhSMXpfuGMikUQ3aEvfgcYGFU,8610
|
6
|
-
tldextract/cli.py,sha256=nCzBAFrgAopTK1t5eBRQgeveSgWheUx4LAlAHE_8mzQ,3010
|
7
|
-
tldextract/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
tldextract/remote.py,sha256=dpLz-s-1AP4Ai4XPVQe-uT2Nmev8CZEMKURdqGw5XiA,2550
|
9
|
-
tldextract/suffix_list.py,sha256=TcUpMTZwsicZn6_eHKqA4bjurQrKYde14P-4HT4s4yE,3896
|
10
|
-
tldextract/tldextract.py,sha256=HRf7efVbEz3_k5dDypjpqNtUXCMb7ZWotZ1pccR5dBo,18776
|
11
|
-
tldextract-5.1.1.dist-info/LICENSE,sha256=oqlDTqZaKpeJ6jYsQYqTkmV8gGGg-o7cO_OnH79KjsE,1522
|
12
|
-
tldextract-5.1.1.dist-info/METADATA,sha256=VGkUfhOCCD14NBzc0f9BqWp1quE995XfKg1Uegn7Uuk,11313
|
13
|
-
tldextract-5.1.1.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
|
14
|
-
tldextract-5.1.1.dist-info/entry_points.txt,sha256=EStkXC80BetCMp1UDhU3kWuXBo3qDpgKltZTJ1x4x1U,51
|
15
|
-
tldextract-5.1.1.dist-info/top_level.txt,sha256=DWZIjV49WP30tyC1KOEP7t-EaS4IRCXQzc0KXAOn_bk,11
|
16
|
-
tldextract-5.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|