Official Python client for soliconfig — remote config (config.fetch) and secrets (secrets.pull) over the REST core.
Project description
soliconfig — Python SDK
Official Python client for soliconfig. A thin wrapper
over the same REST core as the JS SDK (@vennyx/soliconfig): server-evaluated
remote config (config.fetch) and decrypted secrets (secrets.pull).
- Minimal dependencies — only
httpx. - Python 3.9+.
- Fully type-hinted.
Install
pip install soliconfig
Authentication
Every request authenticates with an environment-scoped sc_ API key
(machine identity) sent as Authorization: Bearer sc_.... Create one from the
dashboard and provide it to the client.
from soliconfig import Client
client = Client(api_key="sc_live_...")
base_url defaults to https://api.soliconfig.com; override it for self-hosted
or test setups.
Remote config — config.fetch
Server-evaluated, single-shot fetch. The server resolves every parameter for the evaluation context you pass and returns the result — no local state.
result = client.config.fetch(
context={
"randomizationId": "user-42", # required
"country": "TR", # optional
"platform": "web", # optional
"customSignals": {"tier": "pro"},
},
template_type="client", # "client" (default) or "server"
)
print(result.version) # e.g. 7
# Values are typed strings on the wire; .value() casts by valueType
banner = result.value("welcome_banner", default=False) # -> bool
limit = result.value("max_items", default=10) # -> int/float
config = result.value("feature_config", default={}) # -> parsed JSON
# Or fetch-then-read one key in a single call:
theme = client.config.get("theme", {"randomizationId": "user-42"}, default="light")
fetch returns a ConfigFetchResult with .version and .evaluated
(dict[str, EvaluatedValue]). Each EvaluatedValue has .value, .value_type,
.source, .matched_condition, and .cast().
Quota / entitlement errors
The config gate can reject a fetch with HTTP 429 and a machine-readable code:
from soliconfig import SoliconfigApiError
try:
result = client.config.fetch(context={"randomizationId": "user-42"})
except SoliconfigApiError as err:
if err.code == "quota_exceeded": # free plan hard cap
...
elif err.code == "overage_blocked": # unpaid overage on a paid plan
...
else:
raise
Secrets — secrets.pull
Pulls the latest decrypted secrets for an environment. Decryption happens
server-side via the vault endpoint, so the Python client needs no private
key and no crypto dependency — just the sc_ key.
secrets = client.secrets.pull(org="org_abc", environment="env_xyz")
print(secrets.version) # version of the env values
db_url = secrets["DATABASE_URL"] # SecretPullResult behaves like a mapping
for name, value in secrets.items():
...
requireApprovalmust befalse. Server-side decrypt with ansc_key only works when the environment vault hasrequireApproval=false. If approval is required, the API returns202 pendingandsecrets.pullraisesSoliconfigApprovalRequiredError(a human admin must approve each decrypt). Thesc_key must also havereadoradminscope —encrypt-onlykeys can write but never decrypt.
from soliconfig import SoliconfigApprovalRequiredError
try:
secrets = client.secrets.pull(org="org_abc", environment="env_xyz")
except SoliconfigApprovalRequiredError as err:
print("Pending approval:", err.approval_id)
Errors
| Class | When |
|---|---|
SoliconfigError |
Base class for all SDK errors. |
SoliconfigApiError |
Any non-2xx response. Carries .status and (for 429) .code. |
SoliconfigApprovalRequiredError |
Vault requireApproval=true; carries .approval_id. |
Resource cleanup
Client holds an httpx connection pool. Close it when done, or use it as a
context manager:
with Client(api_key="sc_...") as client:
result = client.config.fetch(context={"randomizationId": "user-42"})
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file soliconfig-0.1.0.tar.gz.
File metadata
- Download URL: soliconfig-0.1.0.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dd1c3e4dd78a67c0ec893c46c9b508f3b421516ef1fa152a59338d8d31d9dd8
|
|
| MD5 |
5ffdf0d20f2e8446dc1b252330d1d820
|
|
| BLAKE2b-256 |
2124abd5c0d8541f240cdead6befdac3dca6bb2fb8cb921fab92c7a9db731fe0
|
File details
Details for the file soliconfig-0.1.0-py3-none-any.whl.
File metadata
- Download URL: soliconfig-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ebd343c4b8fc29010bf55095ef129a3767cce826491d63a854157e6882a0b6f
|
|
| MD5 |
8f94cd30e8a54b1874044680f8fcfa12
|
|
| BLAKE2b-256 |
bc2f447d97dca23abc4083959edd4c2271cb23ef5f923f4f5092a035c0838444
|