API Reference
dump(cookies, f)
Dumps a Binary Cookies object to create a binary cookies file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cookies |
CookiesCollection
|
A Binary Cookies object to be serialized. |
required |
f |
Union[BufferedWriter, BytesIO, BinaryIO]
|
The file-like object to write the binary cookies data to. |
required |
Source code in src/binarycookies/_serialize.py
dumps(cookies)
Dumps a Binary Cookies object to a byte string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cookies |
CookiesCollection
|
A Binary Cookies object to be serialized. |
required |
Returns: bytes: The serialized binary cookies data.
Source code in src/binarycookies/_serialize.py
load(bf)
Deserializes a binary cookie file and returns a list of Cookie objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bf |
BinaryIO
|
A binary file object containing the binary cookie data. |
required |
Returns: List[Cookie]: A list of Cookie objects.
Source code in src/binarycookies/_deserialize.py
loads(b)
Deserializes a binary cookie file and returns a list of Cookie objects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
b |
BytesIO
|
A BytesIO object containing the binary cookie data. |
required |
Returns: List[Cookie]: A list of Cookie objects.
Source code in src/binarycookies/_deserialize.py
cli(file_path, output=OutputType.json)
CLI entrypoint for reading Binary Cookies
Source code in src/binarycookies/__main__.py
binarycookies.models.Cookie
Represents a cookie in the binary cookies format.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the cookie. |
value |
str
|
The value of the cookie. |
url |
str
|
The URL associated with the cookie. |
path |
str
|
The path for which the cookie is valid. |
create_datetime |
datetime
|
The creation date and time of the cookie. |
expiry_datetime |
datetime
|
The expiration date and time of the cookie. |
flag |
Flag
|
The flags associated with the cookie, such as Secure or HttpOnly. |