Skip to main content

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 by openapi-python-client from sdks/openapi/public.json. Never hand-edited, regenerated by make sdk-python.
  • pulsight/ — the handwritten ergonomic layer: api-token auth, 429 retry, typed errors. Depends only on httpx.

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-python emits them under pulsight_api_client/api/*. The ergonomic helpers (raise_for_response, credits_remaining) take an httpx.Response, which the generated *_detailed calls 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pulsight-0.1.0.tar.gz (75.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pulsight-0.1.0-py3-none-any.whl (218.5 kB view details)

Uploaded Python 3

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

Hashes for pulsight-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4dad4e838c0d28bb0fb70f4738f0a0c1088a3b07201236a94660a0c19f67a327
MD5 113dc07d7e600f7aa41214350b8dd587
BLAKE2b-256 cbc5cba8308371c4ddbe1804cf6c5b1566036740bf93d13233dfa555e96a6398

See more details on using hashes here.

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

Hashes for pulsight-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9709552a86b79ebc90218a0fcd3db7f52ad25b5a9d41e5a1ddd86518399301b
MD5 2b633d25a76b5e20c28762e4a9abea87
BLAKE2b-256 bb48097f3e3649455c80a5ba06fabe1f25fadf1e01e3173ed24c3c9372a4d6b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page