onlinemediagroup / publicsuffix

Python interface to the Public Suffix List

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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'

About

Python interface to the Public Suffix List

License:Apache License 2.0


Languages

Language:Python 100.0%