A thread-safe cookie jar for storing and managing HTTP cookies.
This cookie jar can be safely shared across multiple threads and is used
to automatically handle cookies during HTTP requests and responses.
By default, cookie compression is enabled to reduce storage overhead.
Use uncompressed() to create a variant without compression if needed.
Source code in rnet/cookie.py
| class Jar:
r"""
A thread-safe cookie jar for storing and managing HTTP cookies.
This cookie jar can be safely shared across multiple threads and is used
to automatically handle cookies during HTTP requests and responses.
By default, cookie compression is enabled to reduce storage overhead.
Use `uncompressed()` to create a variant without compression if needed.
"""
def __init__(self, compression: bool | None = None) -> None:
r"""
Create a new cookie jar with compression enabled by default.
"""
...
def compressed(self) -> "Jar":
r"""
Clone this Jar, sharing storage but enabling compression.
"""
...
def uncompressed(self) -> "Jar":
r"""
Clone this Jar, sharing storage but disabling compression.
"""
...
def get(self, name: str, url: str) -> Cookie | None:
r"""
Get a cookie by name and URL.
"""
...
def get_all(self) -> Sequence[Cookie]:
r"""
Get all cookies.
"""
...
def add(self, cookie: Cookie | str, url: str) -> None:
r"""
Add a cookie or cookie string to this jar.
"""
...
def remove(self, name: str, url: str) -> None:
r"""
Remove a cookie from this jar by name and URL.
"""
...
def clear(self) -> None:
r"""
Clear all cookies in this jar.
"""
...
|
__init__
__init__(compression=None)
Create a new cookie jar with compression enabled by default.
Source code in rnet/cookie.py
| def __init__(self, compression: bool | None = None) -> None:
r"""
Create a new cookie jar with compression enabled by default.
"""
...
|
compressed
Clone this Jar, sharing storage but enabling compression.
Source code in rnet/cookie.py
| def compressed(self) -> "Jar":
r"""
Clone this Jar, sharing storage but enabling compression.
"""
...
|
uncompressed
Clone this Jar, sharing storage but disabling compression.
Source code in rnet/cookie.py
| def uncompressed(self) -> "Jar":
r"""
Clone this Jar, sharing storage but disabling compression.
"""
...
|
get
Get a cookie by name and URL.
Source code in rnet/cookie.py
| def get(self, name: str, url: str) -> Cookie | None:
r"""
Get a cookie by name and URL.
"""
...
|
get_all
Get all cookies.
Source code in rnet/cookie.py
| def get_all(self) -> Sequence[Cookie]:
r"""
Get all cookies.
"""
...
|
add
Add a cookie or cookie string to this jar.
Source code in rnet/cookie.py
| def add(self, cookie: Cookie | str, url: str) -> None:
r"""
Add a cookie or cookie string to this jar.
"""
...
|
remove
Remove a cookie from this jar by name and URL.
Source code in rnet/cookie.py
| def remove(self, name: str, url: str) -> None:
r"""
Remove a cookie from this jar by name and URL.
"""
...
|
clear
Clear all cookies in this jar.
Source code in rnet/cookie.py
| def clear(self) -> None:
r"""
Clear all cookies in this jar.
"""
...
|