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

Uploaded Source

Built Distribution

psl-2024.8.12-py3-none-any.whl (50.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: psl-2024.8.12.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for psl-2024.8.12.tar.gz
Algorithm Hash digest
SHA256 3b5bb36aaa853a811aa31ba02c0bb4aaa0a721a2ba18a0843075c7ec36f06503
MD5 8e640aadd73e5a788fd961e6b95a967b
BLAKE2b-256 8c24aed10d3cf582fbebab31635def0fe6383ab7e2293fd75e9b93180f1608af

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: psl-2024.8.12-py3-none-any.whl
  • Upload date:
  • Size: 50.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for psl-2024.8.12-py3-none-any.whl
Algorithm Hash digest
SHA256 f9b7c247b9c4e74ddeb2688d7eee65f49d49f7f28b7cf1834363a01ebd625010
MD5 46a7e99f96590580702687a22bdbf606
BLAKE2b-256 d966a04349f8835ce278b449e2c12c81694037991f262e27066da6e8f29cdb28

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