duck.http.session.session_storage_connector

Module containing SessionConnector class which can be used to connect to session storage to perform operations like get, set, update, delete, clear, etc.

Module Contents

Classes

SessionStorageConnector

This class is used to connect to the session storage and perform almost all the operations on the session storage

Functions

get_session_storage_connector

Returns the session storage connector object.

Data

globals

API

exception duck.http.session.session_storage_connector.NonPersistentStorageError

Bases: Exception

class duck.http.session.session_storage_connector.SessionStorageConnector(session_storage_cls: Callable)

This class is used to connect to the session storage and perform almost all the operations on the session storage

Initialization

Initialize SessionStorageConnector

Parameters:

session_storage_cls – Class to initialize the session storage object

__new__(session_storage_cls: duck.utils.caching.CacheBase)
clear_all_sessions()

Clear all session data.

close()

Close the session storage.

delete_session(session_id: str)

Delete session data.

static generate_session_id() str

Retrieve a random generated session ID.

get_session(session_id: str)

Get the session data.

save()

Saves the current sessions to session storage.

set_session(session_id: str, data: dict, expiry: int | float = None)

Set the session data.

update_session(session_id: str, data: dict)

Update the session data.

duck.http.session.session_storage_connector.get_session_storage_connector()

Returns the session storage connector object.

duck.http.session.session_storage_connector.globals

‘import_module_once(…)’