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.
SuqoClientworks 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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
833f7bdf5593f9b01e3fbf89bc28ddd2262178221f519b70df6b9cbdcb37f53d
|
|
| MD5 |
2e4f670b316a426fe7937a20c17b301a
|
|
| BLAKE2b-256 |
f99dfdd00431832d920e716c17f1de2d8ab8d65d24cd367f6e7646da1e400a8f
|
Provenance
The following attestation bundles were made for suqo-0.1.0.tar.gz:
Publisher:
publish.yml on Code-Pros-AI/suqo-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
suqo-0.1.0.tar.gz -
Subject digest:
833f7bdf5593f9b01e3fbf89bc28ddd2262178221f519b70df6b9cbdcb37f53d - Sigstore transparency entry: 2461102985
- Sigstore integration time:
-
Permalink:
Code-Pros-AI/suqo-sdk-python@90f1935b1cc723943645c3744302d6ef18164c4d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Code-Pros-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90f1935b1cc723943645c3744302d6ef18164c4d -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f78983418fe06e5cd891755f5df0e6f973ebe29d855a1c99aac5af91e774b1e7
|
|
| MD5 |
8de4bb78c3df96e9fbf8942f1bcfc91e
|
|
| BLAKE2b-256 |
3eaae0c2cc9772f675c72af29088b7e7836a4064ad52cf4f5351495e713be72e
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
suqo-0.1.0-py3-none-any.whl -
Subject digest:
f78983418fe06e5cd891755f5df0e6f973ebe29d855a1c99aac5af91e774b1e7 - Sigstore transparency entry: 2461103048
- Sigstore integration time:
-
Permalink:
Code-Pros-AI/suqo-sdk-python@90f1935b1cc723943645c3744302d6ef18164c4d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Code-Pros-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90f1935b1cc723943645c3744302d6ef18164c4d -
Trigger Event:
release
-
Statement type: