Official Python client for the Pulsight API
Project description
pulsight (Python)
Official Python client for the Pulsight public API.
Layout
pulsight_api_client/— protocol core generated byopenapi-python-clientfromsdks/openapi/public.json. Never hand-edited, regenerated bymake sdk-python.pulsight/— the handwritten ergonomic layer: api-token auth, 429 retry, typed errors. Depends only onhttpx.
Generate
From the repo root:
make sdk-python
Or directly:
pipx run openapi-python-client generate \
--path sdks/openapi/public.json \
--config sdks/python/openapi-python-client-config.yaml \
--meta none --output-path sdks/python/pulsight_api_client --overwrite
Usage
import pulsight
from pulsight_api_client import AuthenticatedClient
from pulsight_api_client.api.data import list_traders
# Hand the authenticated httpx client to the generated AuthenticatedClient.
http = pulsight.build_client("pk_live_…") # api token from the settings UI
client = AuthenticatedClient(base_url=pulsight.DEFAULT_BASE_URL, token="").set_httpx_client(http)
resp = list_traders.sync_detailed(client=client)
pulsight.raise_for_response(resp.parsed and resp or resp) # see note below
print("credits left:", pulsight.credits_remaining(resp))
The exact generated call signatures depend on the spec's operation ids;
make sdk-pythonemits them underpulsight_api_client/api/*. The ergonomic helpers (raise_for_response,credits_remaining) take anhttpx.Response, which the generated*_detailedcalls expose.
Error mapping
| HTTP | Exception |
|---|---|
402 CREDIT_EXHAUSTED |
CreditExhaustedError(pool) |
| 429 | RateLimitedError(retry_after) (idempotent GETs auto-retry) |
| 403 (missing scope) | MissingScopeError(message) |
| other non-2xx | APIError(status_code, body) |
All inherit PulsightError.
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 pulsight-0.1.0.tar.gz.
File metadata
- Download URL: pulsight-0.1.0.tar.gz
- Upload date:
- Size: 75.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dad4e838c0d28bb0fb70f4738f0a0c1088a3b07201236a94660a0c19f67a327
|
|
| MD5 |
113dc07d7e600f7aa41214350b8dd587
|
|
| BLAKE2b-256 |
cbc5cba8308371c4ddbe1804cf6c5b1566036740bf93d13233dfa555e96a6398
|
File details
Details for the file pulsight-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pulsight-0.1.0-py3-none-any.whl
- Upload date:
- Size: 218.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9709552a86b79ebc90218a0fcd3db7f52ad25b5a9d41e5a1ddd86518399301b
|
|
| MD5 |
2b633d25a76b5e20c28762e4a9abea87
|
|
| BLAKE2b-256 |
bb48097f3e3649455c80a5ba06fabe1f25fadf1e01e3173ed24c3c9372a4d6b2
|