Class used to generate nicer error messages if sessions are not available. Will still allow read-only access to the empty session but fail on setting.
Methods
__setitem__()
def __setitem__(
key: t.Any,
value: t.Any
) - > t.NoReturn
Raises a RuntimeError when attempting to set a session value, indicating that sessions are unavailable without a secret key.
Parameters
| Name | Type | Description |
|---|
| key | t.Any | The session key to be set. |
| value | t.Any | The value to be assigned to the session key. |
Returns
| Type | Description |
|---|
t.NoReturn | This method never returns as it always raises a RuntimeError. |
__delitem__()
def __delitem__(
key: t.Any
) - > t.NoReturn
Raises a RuntimeError when attempting to delete a session value, indicating that sessions are unavailable without a secret key.
Parameters
| Name | Type | Description |
|---|
| key | t.Any | The session key to be deleted. |
Returns
| Type | Description |
|---|
t.NoReturn | This method never returns as it always raises a RuntimeError. |
clear()
def clear() - > t.NoReturn
Raises a RuntimeError when attempting to clear the session, indicating that sessions are unavailable without a secret key.
Returns
| Type | Description |
|---|
t.NoReturn | This method never returns as it always raises a RuntimeError. |
pop()
def pop(
key: t.Any,
default: t.Any
) - > t.NoReturn
Raises a RuntimeError when attempting to pop a value from the session, indicating that sessions are unavailable without a secret key.
Parameters
| Name | Type | Description |
|---|
| key | t.Any | The session key to remove and return. |
| default | t.Any | The value to return if the key is not found. |
Returns
| Type | Description |
|---|
t.NoReturn | This method never returns as it always raises a RuntimeError. |
popitem()
def popitem() - > t.NoReturn
Raises a RuntimeError when attempting to pop an item from the session, indicating that sessions are unavailable without a secret key.
Returns
| Type | Description |
|---|
t.NoReturn | This method never returns as it always raises a RuntimeError. |
update()
def update(
*args: t.Any,
**kwargs: t.Any
) - > t.NoReturn
Raises a RuntimeError when attempting to update the session with multiple values, indicating that sessions are unavailable without a secret key.
Parameters
| Name | Type | Description |
|---|
| *args | t.Any | Positional arguments containing key-value pairs for the update. |
| **kwargs | t.Any | Keyword arguments containing key-value pairs for the update. |
Returns
| Type | Description |
|---|
t.NoReturn | This method never returns as it always raises a RuntimeError. |
setdefault()
def setdefault(
key: t.Any,
default: t.Any
) - > t.NoReturn
Raises a RuntimeError when attempting to set a default session value, indicating that sessions are unavailable without a secret key.
Parameters
| Name | Type | Description |
|---|
| key | t.Any | The session key to check or set. |
| default | t.Any | The default value to set if the key does not exist. |
Returns
| Type | Description |
|---|
t.NoReturn | This method never returns as it always raises a RuntimeError. |