sponsorkit.storage
Local storage.
On this page
import sponsorkit.storageLocal storage.
The storage directory holds one JSON file per target set, named <targets_hash>.json:
{ "v": 1, "sessionToken": "sks_…", "cache": { "result": {…}, "storedAt": "ISO-8601" },
"nags": { "<id>": { "runs": 3, "lastShown": "ISO-8601" | null } } }Writes are atomic (temp file + rename). The directory is created 0700 and files are 0600.
Exports#
| Name | Kind | Summary |
|---|---|---|
FileStorage | class | Stores <key>.json files in a directory (the default storage). |
MemoryStorage | class | In-memory storage: nothing touches the disk. |
Storage | protocol | A key/value store for the SDK's state. |
default_storage_dir() | function | Return the per-user config directory used when no storage_dir is given. |
Functions#
default_storage_dir()#
def default_storage_dir(env: Mapping[str, str] | None = None) -> Path | NoneReturn the per-user config directory used when no storage_dir is given.
- Linux and other POSIX:
$XDG_CONFIG_HOME/sponsorkit(default$HOME/.config/sponsorkit) - macOS:
$HOME/Library/Application Support/sponsorkit - Windows:
%APPDATA%\sponsorkit(default%USERPROFILE%\AppData\Roaming\sponsorkit)
Returns None when no such directory can be determined (for example HOME is unset or relative). The client then keeps its state in memory; it never falls back to the current working directory.
Also exported as sponsorkit.default_storage_dir.