Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sethmlarson/psl
Mozilla Public Suffix list as a Python package and updated daily.
https://github.com/sethmlarson/psl
http-cookies iana icann public-suffix public-suffix-list python
Last synced: 30 days ago
JSON representation
Mozilla Public Suffix list as a Python package and updated daily.
- Host: GitHub
- URL: https://github.com/sethmlarson/psl
- Owner: sethmlarson
- License: mpl-2.0
- Created: 2019-09-25T17:55:34.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T13:04:24.000Z (9 months ago)
- Last Synced: 2024-05-01T23:06:45.220Z (8 months ago)
- Topics: http-cookies, iana, icann, public-suffix, public-suffix-list, python
- Language: Python
- Homepage: https://publicsuffix.org
- Size: 247 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# psl
[![Version](https://img.shields.io/pypi/v/psl)](https://pypi.org/project/psl)
[![Downloads](https://pepy.tech/badge/psl)](https://pepy.tech/project/psl)
![CI](https://img.shields.io/github/workflow/status/sethmlarson/psl/CI/master)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()`
```python
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()`
```python
def domain_can_set_cookie(*, http_domain: str, cookie_domain: str) -> bool: ...
```Determines if a user-agent that receives an HTTP response from domain ``
with `Set-Cookie` headers with parameter `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