No project description provided
Project description
onlyTLD
Just only get TLD from domain. No other function. No non-standard library dependencies.
Because it is simple, it is fast. One million queries only require 2.4s.
How to use
In Python3.5+:
from onlytld import get_tld, get_sld
assert get_tld("abersheeran.com") == "com"
assert get_sld("upload.abersheeran.com") == "abersheeran.com"
Support punycode-encoded domain names: if a punycode-encoded domain is passed in, a punycode-encoded domain will be returned, otherwise a utf8 string will be returned.
Update TLD List
Refer to https://www.publicsuffix.org/list/, you can run onlytld.data.fetch_list regularly in the code or run python -m onlytld.data in crontab.
Use yourself TLD List
Maybe this is useless, but I still set this function.
from onlytld import set_datapath, get_tld
set_datapath(YOUR_FILE_PATH)
assert get_tld("chinese.cn") == "cn"
Why this
There are many libraries in pypi that can get tld, such as publicsuffix2, publicsuffixlist, dnspy, but they have too many functions. I just need a repository that can get tld, and it is best not to have dependencies other than the non-standard library.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onlytld-0.0.6.tar.gz.
File metadata
- Download URL: onlytld-0.0.6.tar.gz
- Upload date:
- Size: 79.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.7.4 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6096fd86d5823dbd96165f23b5a79a227ddc3a76a8b47b8931377377a4d2abf3
|
|
| MD5 |
9255ec3f0f97069f14807540846178c3
|
|
| BLAKE2b-256 |
542d67721e86d2d15610b30ebbab16112d33ad3a281b7d8c6847a947668460a4
|
File details
Details for the file onlytld-0.0.6-py3-none-any.whl.
File metadata
- Download URL: onlytld-0.0.6-py3-none-any.whl
- Upload date:
- Size: 80.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.7.4 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85d1551b5b25e77d21dedbe9e2a9faac8869e48244f6720ff05058185c9753b5
|
|
| MD5 |
7687e14381d9ea5e93da787635bdd55e
|
|
| BLAKE2b-256 |
2d6c162352c7153665ef53adfc27e3251ac8559f5b915044f9771ed71b51a0b2
|