Docs API reference Python API reference Python API reference Every public class, function, type alias and constant of the sponsorkit package 1.0.0.
On this page Reference for the sponsorkit Python package, version 1.0.0, generated from its
source code and docstrings. For explanations and complete examples start with the
Python guide ; the concepts behind every SDK are in
Concepts .
Terminal Copy code python -m pip install sponsorkit
Import everything from the top-level package: from sponsorkit import Sponsorkit. The
backend helpers live in
sponsorkit.server
and are re-exported too. Every blocking method of the client has an a-prefixed async
variant (sign_in() and asign_in()).
Client#
Name Kind Summary Sponsorkitclass Reports what the current user contributed to your accounts, and sends them to contribute. Nagclass A named nag created by Sponsorkit.nag(). SignInMethodtype alias How native sign-in delivers the code. CancelEventtype alias The cancellation primitive for sync calls: set the event to cancel.
Results#
Name Kind Summary ContributionResultclass What the current user has contributed to the configured targets. Contributionclass A sponsorship (GitHub) or order (Open Collective) to one of the targets. CheckoutResultclass The outcome of Sponsorkit.open_checkout(). Moneyclass An amount in minor units (cents) and an uppercase ISO 4217 currency. SponsorEntityclass Who pays: the signed-in user or an organization they belong to. Tierclass A provider tier. Supporterclass The signed-in supporter. Identityclass A provider account the supporter signed in with. Statustype alias One of active, paused, cancelled, paid, refunded, disputed, failed, pending. Frequencytype alias One of one_time, monthly, yearly. Kindtype alias One of recurring, one_time.
Errors#
Name Kind Summary SponsorkitErrorexception An error raised by Sponsorkit. ErrorCodetype alias Every value SponsorkitError.code can take.
Backend verification#
Name Kind Summary verify_session()function Verify a session token and return the supporter's live contributions. averify_session()function Async variant of verify_session() (uses AsyncClient). sponsorkit.server.TargetsArgtype alias Targets as {"github": ..., "open_collective": ...}, a target param, or a list of target strings.
Targets#
Name Kind Summary Targetclass A normalized target (lowercased, trimmed account). Providertype alias A contribution provider. targets_param()function The canonical target param: the canonical set joined with ,. targets_hash()function Lowercase hex SHA-256 of the UTF-8 target param (used for storage keys).
Storage#
Name Kind Summary Storageprotocol A key/value store for the SDK's state. FileStorageclass Stores <key>.json files in a directory (the default storage). MemoryStorageclass In-memory storage: nothing touches the disk. default_storage_dir()function Return the per-user config directory used when no storage_dir is given.
Testing#
Name Kind Summary MockPresettype alias A mock preset name. MockDataclass Custom mock data: the SDK reports a signed-in supporter with exactly these contributions. MOCK_PRESET_NAMESconstant Every mock preset name, in the order of the MockPreset literal. reset_process_state()function Forget per-process memo state, as if the app had been restarted.
Helpers#
Name Kind Summary parse_duration()function Parse an ISO-8601 duration (P7D, PT12H, P1W…); a timedelta passes through. __version__constant The installed package version.
Other public names#
Exported by a public submodule (not by sponsorkit itself).
Modules#