Package#
The top-level sfdctrust package is the stable import location for the public
API. Underscore-prefixed modules are implementation details.
- class sfdctrust.SQLitePATStore(path=None, *, alias=None)[source]#
Open an existing, protected SQLite store for one PAT lineage on this host.
pathaccepts a string orpathlib.Path.aliasselects another basename in~/.sfdctrustand is mutually exclusive withpath. Connections close after each operation; the adapter needs no close method.- classmethod initialize(*, pat, path=None, alias=None)[source]#
Exclusively create a private database, durably save the initial PAT, and return the adapter. Every existing destination is refused. The final private directory may be created if its parent exists. No existing permissions are changed. Invalid input or initialization failure raises
ConfigurationError. Prefer the hidden-prompt module command for interactive setup.
- load()[source]#
Return the latest committed
PATStoreRecord(including its pending marker), orNoneif the supported database is unseeded. Unsafe access, incompatible schema, and invalid records raiseConfigurationError.
- compare_and_swap(*, expected_revision, expected_attempt, replacement)[source]#
Compare both UUID identifiers, including a
Noneattempt, and commit the complete replacement record atomically. ReturnTrueonly after durable commit andFalseonly for a comparison mismatch. Invalid arguments or an unconfirmed write raisePATPersistenceError.
See Built-in SQLite store for supported storage, protection, initialization, schema compatibility, and recovery.
- class sfdctrust.TrustCenterClient(pat, *, http_client=None, max_retries=2)[source]#
Configure a synchronous client with an explicit PAT. Construction makes no network requests.
- classmethod from_env(*, pat=..., http_client=None, max_retries=2)[source]#
Read
SFDCTRUST_PATifpatis omitted. An explicit override is validated directly, including an explicitNone, which raisesConfigurationError. See Authentication and PAT rotation.
- classmethod from_store(store, *, http_client=None, max_retries=2)[source]#
Load a caller-supplied PAT store. See Authentication and PAT rotation for the adapter contract, operator recovery and public result types.
- refresh_pat(*, expires_in_days=None)[source]#
Rotate a store-backed PAT once and return a secret-free
PATRefreshResultafter durable storage.
Use the client as a synchronous context manager to close SDK-owned connections.
All credential entry points accept a trusted, caller-owned HTTPX client through
http_client=. Context exit and close() leave an injected client open. The
SDK still applies its fixed destination, per-attempt timeouts, redirect policy,
and error translation. The injected client controls TLS, proxies, hooks, and
the underlying transport, which may implement its own retries.
All entry points accept max_retries: int = 2, the number of additional
SDK attempts per eligible request. Integers from 0 through 5 are valid.
Booleans and other invalid values raise ConfigurationError.
See Internal HTTP transport for retry timing. See Tenants and Status, event search, and event detail for the resource operations.
Async client#
Import AsyncTrustCenterClient from sfdctrust for use with asyncio.
Construction and from_env() are ordinary calls. Use async with
or await client.aclose() to close SDK-owned HTTP connections.
All async credential entry points accept an optional trusted, caller-owned
httpx.AsyncClient. Use the client and its adapter on one event loop.
Await tenants.list(), tenants.get(), status.snapshot(),
events.search(), events.get(), tenants.list_all(), and
events.search_all(). They use the same arguments and models as the
synchronous operations. Consume tenants.iter_all() and
events.iter_search() directly with async for. These two methods
return lazy async iterators when called. Collectors begin traversal when
their coroutines run.
- class sfdctrust.AsyncTrustCenterClient(pat, *, http_client=None, max_retries=2)[source]#
Configure an asyncio client with an explicit PAT.
- classmethod from_env(*, pat=..., http_client=None, max_retries=2)[source]#
Use the explicit PAT override if supplied. Otherwise read
SFDCTRUST_PAT.
- async classmethod from_store(store, *, http_client=None, max_retries=2)[source]#
Load a seeded
AsyncPATStoreand check for a pending attempt.
- class sfdctrust.AsyncPATStore[source]#
Protocol for durable asynchronous storage shared by every rotator of one PAT lineage. See Authentication and PAT rotation for the adapter contract and recovery.
- sfdctrust.__version__#
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
The installed package version as a string.