Skip to main content

Mozilla Public Suffix list as a Python package and updated daily

Project description

psl

Version Downloads CI

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-2022.12.5.tar.gz (50.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psl-2022.12.5-py3-none-any.whl (49.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: psl-2022.12.5.tar.gz
  • Upload date:
  • Size: 50.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.14

File hashes

Hashes for psl-2022.12.5.tar.gz
Algorithm Hash digest
SHA256 1af0225e389daa84cf1087c46702f89fcf965aade3b0b52db29eca1da25aa944
MD5 521ad383a7b74e03ea5be15aab097162
BLAKE2b-256 07f3ec71635edee0cc51da3cbafb16c0a638dbdb5ff44d16edc2a18bc263e34f

See more details on using hashes here.

File details

Details for the file psl-2022.12.5-py3-none-any.whl.

File metadata

  • Download URL: psl-2022.12.5-py3-none-any.whl
  • Upload date:
  • Size: 49.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.14

File hashes

Hashes for psl-2022.12.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8f82632c3ae5cabc4d903f2826395ad2cb0a308d1fbe8ad35171fd6f517aca5c
MD5 213501f3b2cd3d066197408cc3f255ec
BLAKE2b-256 470b2dba872d325ce071245be3ba1f3aa71d4a1c9871218269adee72ff5f1b23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page