Skip to main content

Mozilla Public Suffix list as a Python package and updated daily

Project description

psl

Mozilla Public Suffix list as a Python package and updated daily.

Install via python -m pip install psl

See https://publicsuffix.org for more information regarding the list itself.

API

The package provides the following members as an API:

domain_suffixes()

def domain_suffixes(dn: str, *, icann_only: bool=False) -> Suffixes: ...

Queries the Public Suffix list for the given domain and returns a named tuple containing the public and private suffixes for the domain. Either value can be None if that field isn't available. (eg private=None for the domain com)

domain_can_set_cookie()

def domain_can_set_cookie(*, http_domain: str, cookie_domain: str) -> bool: ...

Determines if a user-agent that receives an HTTP response from domain <http_domain> with Set-Cookie headers with parameter Domain=<cookie_domain> should allow that cookie to be set. This disallows cookies from being set on public suffixes and on domains that the HTTP domain has no authority over.

This is the same mechanism that modern browsers use to determine whether it's safe to set a cookie to prevent 'super-cookies'.

License

MPL-2.0

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psl-2020.9.4.tar.gz (47.3 kB view details)

Uploaded Source

File details

Details for the file psl-2020.9.4.tar.gz.

File metadata

  • Download URL: psl-2020.9.4.tar.gz
  • Upload date:
  • Size: 47.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1

File hashes

Hashes for psl-2020.9.4.tar.gz
Algorithm Hash digest
SHA256 af64ec897aa17c94816c8618d0900970b2aaa47f46fb839b72e9e6914d19bc2c
MD5 bf292213eb6b5469e5c4ebb84550994b
BLAKE2b-256 ce91c9b2f59f5bdc1b25e448b7d5678308cde093998a9dd7b47b5bf406ec8c1a

See more details on using hashes here.

Provenance

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