Skip to main content

Official Python SDK for Imbrace — dual auth (API Key + Access Token)

Project description

Imbrace Python SDK

Official Python client for the Imbrace Gateway. Supports sync and async.

Installation

pip install imbrace

Quick Start

API Key — server-side scripts, Celery tasks

from imbrace import ImbraceClient

client = ImbraceClient(api_key="sk-xxx...")

me = client.platform.get_me()

Access Token — after user login

client = ImbraceClient(access_token="acc_xxxxxxxxxxxxx")

OTP Login Flow

client = ImbraceClient()

client.request_otp("user@example.com")
client.login_with_otp("user@example.com", "123456")

# all subsequent calls are authenticated
me = client.platform.get_me()

Async Client

from imbrace import AsyncImbraceClient

async with AsyncImbraceClient(api_key="sk-xxx...") as client:
    me = await client.platform.get_me()

Error Handling

from imbrace import AuthError, ApiError, NetworkError

try:
    client.platform.get_me()
except AuthError:
    print("Invalid credentials")
except ApiError as e:
    print(f"[{e.status_code}] {e}")
except NetworkError:
    print("Gateway unreachable")

Environment Variables

Variable Description
IMBRACE_API_KEY API key (server-side auth)
IMBRACE_GATEWAY_URL Override gateway URL (default: https://app-gatewayv2.imbrace.co)
IMBRACE_ENV Environment preset: develop, sandbox, stable (default: stable)

Development

pip install -e ".[dev]"
pytest                    # unit tests
pytest tests/integration  # integration tests (requires IMBRACE_API_KEY)

Resources

Full resource reference: sdk.imbrace.co/python/resources

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

imbrace-1.0.3.tar.gz (75.0 kB view details)

Uploaded Source

Built Distribution

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

imbrace-1.0.3-py3-none-any.whl (62.8 kB view details)

Uploaded Python 3

File details

Details for the file imbrace-1.0.3.tar.gz.

File metadata

  • Download URL: imbrace-1.0.3.tar.gz
  • Upload date:
  • Size: 75.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for imbrace-1.0.3.tar.gz
Algorithm Hash digest
SHA256 516a6d3c8db4074229c51545585a5d5a3cc0cd64ec6bf05d00cebfe64638bbc1
MD5 9accfc2e2c7fa6f4c9384c5f451ddec9
BLAKE2b-256 bc90c936e0317619e0563b5deaa53e1b77e0b988b74af3a509b6e9135b4c0b2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbrace-1.0.3.tar.gz:

Publisher: publish-py-pypi.yml on imbraceltd/api-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imbrace-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: imbrace-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 62.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for imbrace-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4f69508cb2ff2b3355b57b94f4b5dd9996c9fbaf7e5a29a49cae8bbc5ec55f93
MD5 bc9e3756f4e071a0285e03c70659201f
BLAKE2b-256 db2e4802ca249ea5481b7394aadaebef8018ec86a791f8ea7b373b58c4f2334c

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbrace-1.0.3-py3-none-any.whl:

Publisher: publish-py-pypi.yml on imbraceltd/api-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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