skip to navigation
skip to content

Not Logged In

publicsuffix 1.0.5

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

This module allows you to get the public suffix of a domain name using the Public Suffix List from http://publicsuffix.org

A public suffix is one under which Internet users can directly register names. Some examples of public suffixes are .com, .co.uk and pvt.k12.wy.us. 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.

The Python module ships with a (possibly out-dated) copy of the Public Suffix List so that it is usable out of the box. It's up the user to keep it up-to-date with the most recent version of the list available on http://publicsuffix.org

Module content

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

>>> from publicsuffix import PublicSuffixList
>>> psl = PublicSuffixList()
>>> psl.get_public_suffix("www.example.com")
'example.com'

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.

Source

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

git clone http://www.tablix.org/~avian/git/publicsuffix.git
 
File Type Py Version Uploaded on Size
publicsuffix-1.0.5.tar.gz (md5) Source 2014-01-24 43KB
  • Downloads (All Versions):
  • 111 downloads in the last day
  • 1040 downloads in the last week
  • 5042 downloads in the last month