Skip to main content

suqo-python

Python SDK for the Suqo external API (/api/v1/).

pip install -e .

Usage

from suqo import SuqoClient

client = SuqoClient(api_key="su_key_...")        # or set SUQO_API_KEY

Point it at another environment with base_url=:

client = SuqoClient(base_url="https://staging.suqo.ai")

Subscriptions

page = client.subscriptions.list(page_size=50)
page["active_subscriptions"]                      # status totals ride along

for subscription in client.subscriptions.iter():  # follows pagination
    print(subscription["subscription_id"], subscription["status"])

client.subscriptions.get(subscription_id)

created = client.subscriptions.create(
    pbp_id="pbp_3n9k2x",
    return_url="https://yourapp.com/thanks",
    client={
        "phone": "9841000100",
        "full_name": "Ram Shrestha",
        "email": "ram@client.com",
        "address": "Kathmandu, Nepal",
        "billing": {                              # optional
            "billing_business_name": "ABC Pvt Ltd.",
            "billing_email": "ram@client.com",
            "billing_address": "Kathmandu, Nepal",
            "billing_pan_vat": "301234567",
        },
        "shipping": {                             # optional
            "phone": "9841000100",
            "full_name": "Ram Shrestha",
            "email": "ram@client.com",
            "address": "Kathmandu, Nepal",
        },
    },
)
created["checkout_url"]                           # send the buyer here to pay

client.subscriptions.cancel(subscription_id)      # at end of current period
client.subscriptions.resume(subscription_id)
client.subscriptions.update_billing_cycle(subscription_id, "2026-09-01")

Customers and products

client.customers.list()
client.customers.get(customer_id)
client.products.list()                            # plans + billing periods nested

Auto-pagination

Every resource has .iter(), a generator that walks all pages for you:

for customer in client.customers.iter():
    print(customer["full_name"], customer["buyer_phone"])

for subscription in client.subscriptions.iter():
    ...

for product in client.products.iter():
    ...

Pages are fetched lazily — page 2 only goes out once page 1 is consumed, so break costs you nothing. Materialise them all with list(...):

customers = list(client.customers.iter())

.list() is the single-page alternative, returning the raw envelope (count, next, previous, results) when you need those fields:

page = client.customers.list(page=2, page_size=100)   # page_size max is 100

page_size works on .iter() too, and cuts the number of round trips:

client.customers.iter(page_size=100)   # 100 per request instead of 20

The API exposes no server-side filters on these endpoints — filter in Python:

active = [s for s in client.subscriptions.iter() if s["status"] == "active"]

Errors

from suqo import ValidationError, AuthenticationError, NotFoundError

try:
    client.subscriptions.create(pbp_id="bad", return_url="...", client={...})
except ValidationError as exc:
    exc.errors        # {"pbp_id": ["... does not exist or is not visible."]}
    exc.status_code   # 400

All errors subclass SuqoError. API failures subclass SuqoAPIError and carry status_code, payload and the raw response.

Notes

  • GETs retry transient failures (429, 5xx) three times with backoff. POSTs never retry — a replayed create would make a second subscription.
  • Responses are plain dicts, matching the API payloads.
  • SuqoClient works as a context manager to close the underlying session.

Tests

python test_suqo.py

Download files

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

Source Distribution

suqo-0.1.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

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

suqo-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file suqo-0.1.0.tar.gz.

File metadata

  • Download URL: suqo-0.1.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for suqo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 833f7bdf5593f9b01e3fbf89bc28ddd2262178221f519b70df6b9cbdcb37f53d
MD5 2e4f670b316a426fe7937a20c17b301a
BLAKE2b-256 f99dfdd00431832d920e716c17f1de2d8ab8d65d24cd367f6e7646da1e400a8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for suqo-0.1.0.tar.gz:

Publisher: publish.yml on Code-Pros-AI/suqo-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 suqo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: suqo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for suqo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f78983418fe06e5cd891755f5df0e6f973ebe29d855a1c99aac5af91e774b1e7
MD5 8de4bb78c3df96e9fbf8942f1bcfc91e
BLAKE2b-256 3eaae0c2cc9772f675c72af29088b7e7836a4064ad52cf4f5351495e713be72e

See more details on using hashes here.

Provenance

The following attestation bundles were made for suqo-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Code-Pros-AI/suqo-sdk-python

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

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

2 files

Supported by

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