Python interface to the Public Suffix List
Python
Switch branches/tags
Nothing to show
Pull request Compare This branch is 5 commits ahead of jpwatts:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
AUTHORS
LICENSE
NOTICE
README.rst
publicsuffix.py
setup.py
test.py

README.rst

fastpublicsuffix

This module provides a Python interface to the Public Suffix List.

The Public Suffix List (PSL) is a set of rules describing "effective top-level domains" and can be used to determine the registered domain for a given host name.

This branch is maintained by MixRank, we reimplemented it using a different data structure (a prefix tree) in order to improve performance.

Usage

You will need to download the list yourself.

Call the init_suffix_tree function with the location of the list. Then call get_root_domain to find the registered domain. This branch does not support asking for the (E)TLD.

Find the registered domain:

>>> publicsuffix.init_suffix_tree('names.dat')
>>> publicsuffix.domain('www.python.org')
u'python.org'