API Docs

domain_utils.domain_utils module

domain_utils.domain_utils.get_ps_plus_1(url, **kwargs)[source]

Returns the PS+1 of the url. This will also return an IP address if the hostname of the url is a valid IP address. An (optional) PublicSuffixList object can be passed with keyword arg ‘psl’, otherwise a version cached in the system temp directory is used.

domain_utils.domain_utils.get_psl(location='/tmp/public_suffix_list.dat')[source]

Grabs an updated public suffix list.

domain_utils.domain_utils.get_stripped_url(url, scheme=False)[source]

Returns a url stripped to (scheme)?+hostname+path

domain_utils.domain_utils.hostname_subparts(url, include_ps=False, **kwargs)[source]

Returns a list of slices of a url’s hostname down to the PS+1 If include_ps is set, the hostname slices will include the public suffix For example: http://a.b.c.d.com/path?query#frag would yield:

[a.b.c.d.com, b.c.d.com, c.d.com, d.com] if include_ps == False [a.b.c.d.com, b.c.d.com, c.d.com, d.com, com] if include_ps == True

An (optional) PublicSuffixList object can be passed with keyword arg ‘psl’. otherwise a version cached in the system temp directory is used.

domain_utils.domain_utils.is_ip_address(hostname)[source]

Check if the given string is a valid IP address

domain_utils.domain_utils.load_psl(function)[source]