Skip to main content

Get a public suffix for a domain name using the Public Suffix List.

Project description

This module allows you to get the public suffix of a domain name using the Public Suffix List from

A public suffix is one under which Internet users can directly register names. Some examples of public suffixes are .com, and Accurately knowing the public suffix of a domain is useful when handling web browser cookies, highlighting the most important part of a domain name in a user interface or sorting URLs by web site.

Module content

The module exports a class that parses the Public Suffix List and allows queries for individual domain names:

>>> psl = PublicSuffixList()
>>> psl.get_public_suffix("")

Please note that the host part of an URL can contain strings that are not plain DNS domain names (IP addresses, Punycode-encoded names, name in combination with a port number or an username, etc.). It is up to the caller to ensure only domain names are passed to the get_public_suffix() method.


You can get a local copy of the development repository with:

git clone

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

publicsuffix-1.0.2.tar.gz (29.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page