Skip to main content
# pytld

Refer to `http://mxr.mozilla.org/mozilla/source/netwerk/dns/src/effective_tld_names.dat?raw=1`. The top-level domain analysis of the URL or domain name.

## Installation

```bash
$ pip install pytld
```

## Usage example

It can be from the URL or domain name analysis top-level domain:

```python
from pytld import get_tld
from pytld import get_full_domain
from pytld import get_hostname


def test_get_tld():
assert get_tld('team.develop.google.hk.', strict=False) == 'develop.google.hk'
assert get_tld('team.develop.google.hk.') == 'google.hk'
assert get_tld('google.hk.') == 'google.hk'
assert get_tld('http://www.example.com:8080/admin.php/afaf?13123') == 'example.com'
assert get_tld('www.google.com') == 'google.com'
assert get_tld('mail.google.com.hk') == 'google.com.hk'
assert get_tld('apps.google.com.hk.') == 'google.com.hk'
assert get_tld('blog.google.hk.') == 'google.hk'


def test_get_full_domain():
assert get_full_domain('http://www.example.com.cn:8080/admin.php/afaf?13123') == 'www.example.com.cn'


def test_get_hostname():
assert get_hostname('http://www.example.com.cn:8080/admin.php/afaf?13123') == 'www'

```

## License

MPL 1.1/GPL 2.0/LGPL 2.1

## Support

For any issues contact me at the e-mail given in the `Author` section.

## Author

mykings <xsseroot@gmail.com>

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytld-0.1.0.tar.gz (76.3 kB view details)

Uploaded Source

File details

Details for the file pytld-0.1.0.tar.gz.

File metadata

  • Download URL: pytld-0.1.0.tar.gz
  • Upload date:
  • Size: 76.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pytld-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3b4f7dd5e29d62731a28074a6eda1f4a6c8a4850571755f0143603059202d176
MD5 6b90b4c9d9242f148a0788291f4b7981
BLAKE2b-256 c93048e1897e028373b5d94a109bb22b3027193a1045cf9b7f178af4fb273fa7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page