Skip to main content

Easy Labs SDK for Python — idiomatic client mirroring @easylabs/node feature surface.

Project description

easylabs

Python SDK for the Easy Labs API.

Status: 0.1.0 — feature parity with @easylabs/node@0.1.0. Sync-only in this release; async (easylabs.aio.Client) is planned for 0.2.

Install

pip install easylabs
# or
uv add easylabs

Requires Python >= 3.10.

Quickstart

import os
from easylabs import Client

client = Client(api_key=os.environ["EASY_API_KEY"])

customer = client.customers.create(
    first_name="Ada",
    last_name="Lovelace",
    email="ada@example.com",
)

subscription = client.subscriptions.create(
    identity_id=customer["id"],
    items=[{"price_id": "price_…"}],
)

Authentication

Pass your secret API key as api_key=. Keys prefixed sk_test_ are automatically routed to the sandbox environment; production keys go to production. Override the URL with internal_api_url= for self-hosted / testing setups.

client = Client(api_key="sk_test_…")            # sandbox
client = Client(api_key="sk_live_…")            # production
client = Client(api_key="sk_test_…",
                internal_api_url="http://localhost:4000/v1/api")  # tests / self-hosted

Resources

Resources are namespaced on the client:

Namespace Highlights
client.customers create, update, retrieve, list, payment_instruments, orders, subscriptions, wallets
client.payment_instruments create, update
client.transfers create, update, retrieve, list, create_refund
client.disputes retrieve, list, update
client.settlements retrieve, list, close
client.products create, update, retrieve, list, archive, with_price, with_prices
client.product_prices create, update, retrieve, list, archive
client.orders retrieve, list, update_tags
client.subscriptions create, update, retrieve, list, cancel, pause, resume, proration_preview, add_item, update_item, remove_item, apply_discount, list_discounts, remove_discount, create_one_time_charge, report_usage, usage_summary, usage_reconciliation
client.checkout create
client.payment_links create
client.embedded_checkout create_session, retrieve_session, crypto_status, validate, confirm, get_config, update_config
client.webhooks_management register, list, update, delete, list_deliveries, list_endpoint_deliveries
client.invoices create, list, retrieve, update, send_invoice, pay, remind, void, pdf_data
client.coupons create, list, retrieve, update, delete
client.promotion_codes create, list, retrieve, update, delete, validate
client.authorizations list, retrieve, capture, void
client.analytics transactions, disputes, settlements, revenue, revenue_recovery
client.compliance_forms list, retrieve, sign
client.dunning_config create_or_replace, retrieve, update
client.revenue_recovery_automations list, create, update, delete, list_runs

Webhooks

from easylabs import Webhooks

@app.post("/webhooks/easy")
def receive(request):
    event = Webhooks.construct_event(
        payload=request.body,
        signature=request.headers.get("x-easy-webhook-signature", ""),
        secret=os.environ["EASY_WEBHOOK_SECRET"],
    )
    # event.type, event.data, event.id ...
    return ("", 204)

Errors

from easylabs import Client, RateLimitError, EasyError

try:
    client.subscriptions.cancel("sub_123")
except RateLimitError as e:
    time.sleep(e.retry_after_seconds or 1)
except EasyError as e:
    print(e.status, e.code, e.details)
    raise

License

MIT

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

easylabs-0.1.1.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

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

easylabs-0.1.1-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

Details for the file easylabs-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for easylabs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 64cce5d2dfa628c6e9df599c68e091c87fb82ddc449214ce124ae8857d04db90
MD5 dd0aa8878e24cffdcc42559cad589933
BLAKE2b-256 5176cfb76c65b55ac717ce5042936771d34c0003c9afbccb7d182ed25db67ab0

See more details on using hashes here.

Provenance

The following attestation bundles were made for easylabs-0.1.1.tar.gz:

Publisher: release.yml on itseasyco/easy-sdk-python

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

File details

Details for the file easylabs-0.1.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for easylabs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31012b076fccd01fcfbfb72e9fb6dedf674ec79d584c0eb02f9f99f1c4f8a4ec
MD5 42b125229316758a18354c3049ac1052
BLAKE2b-256 2b4836e9d1e85c77c20f2fb160796b1ae4fcea6fc4326f53117b0efc265f3fd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for easylabs-0.1.1-py3-none-any.whl:

Publisher: release.yml on itseasyco/easy-sdk-python

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