suqo-python
Python SDK for the Suqo API.
pip install suqo
Python 3.9+. Only dependency is requests.
Quick start
from suqo import SuqoClient
client = SuqoClient(
api_key="su_key_...", # or set SUQO_API_KEY
base_url="https://...", # or set SUQO_BASE_URL
)
for subscription in client.subscriptions.iter():
print(subscription["subscription_id"], subscription["status"])
Responses are plain dicts matching the API payloads.
Methods
| Call | Does |
|---|---|
products.list() / .iter() |
Your catalogue, with plans and billing periods nested |
subscriptions.list() / .iter() |
All subscriptions; list() also returns status totals |
subscriptions.get(id) |
One subscription |
subscriptions.create(...) |
New subscription, returns a checkout_url |
subscriptions.cancel(id) |
Cancel at end of the current period |
subscriptions.resume(id) |
Undo a pending cancellation |
subscriptions.update_billing_cycle(id, date) |
Move the next billing date |
customers.list() / .iter() / .get(id) |
Your buyers |
Creating a subscription
pbp_id identifies a billing period — find one under product["plan"][n]["billing_periods"].
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",
},
)
created["checkout_url"] # send the buyer here to pay
client also takes an optional address, plus optional billing and
shipping blocks:
"billing": {
"billing_business_name": "ABC Pvt Ltd.",
"billing_email": "ram@client.com",
"billing_address": "Kathmandu, Nepal",
"billing_pan_vat": "301234567", # optional
},
"shipping": {
"phone": "9841000100",
"full_name": "Ram Shrestha",
"email": "ram@client.com",
"address": "Kathmandu, Nepal", # optional
},
Pagination
.iter() walks every page for you, fetching lazily:
for customer in client.customers.iter():
...
.list() returns one page with the raw envelope (count, next, previous,
results). Both accept page and page_size (max 100). There are no
server-side filters — filter in Python.
Errors
from suqo import ValidationError
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
ValidationError (400), AuthenticationError (401), PermissionDeniedError
(403), NotFoundError (404), RateLimitError (429) and ServerError (5xx) all
subclass SuqoAPIError, which carries status_code, payload and response.
GETs retry 429s and 5xxs three times with backoff. POSTs never retry — a replayed create would make a second subscription.
Configuration
SuqoClient(
api_key=None, # required; falls back to SUQO_API_KEY
base_url=None, # required; falls back to SUQO_BASE_URL
timeout=30,
max_retries=3, # GET only; 0 disables
session=None, # inject your own requests.Session
)
api_key and base_url are both required — there is no default host, so which
environment you talk to is always an explicit choice. Missing either raises
ValueError at construction.
Also works as a context manager, closing the session on exit.
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.2.0.tar.gz.
File metadata
- Download URL: suqo-0.2.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6e1edf39cfecc9a2ef9d47b23a78e7f0bea05b81c712f6639b7d29f1c12052d
|
|
| MD5 |
658c0d05107ae46deeab7a7b2f938a19
|
|
| BLAKE2b-256 |
149aa36dfe52e1ffa77cb31af356623e2ee365a1420d591fa1922b0f129ba627
|
Provenance
The following attestation bundles were made for suqo-0.2.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.2.0.tar.gz -
Subject digest:
f6e1edf39cfecc9a2ef9d47b23a78e7f0bea05b81c712f6639b7d29f1c12052d - Sigstore transparency entry: 2461300655
- Sigstore integration time:
-
Permalink:
Code-Pros-AI/suqo-sdk-python@ee3cc90df08c01eee9531d30b4e41fad978851bd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Code-Pros-AI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ee3cc90df08c01eee9531d30b4e41fad978851bd -
Trigger Event:
release
-
Statement type:
File details
Details for the file suqo-0.2.0-py3-none-any.whl.
File metadata
- Download URL: suqo-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.6 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 |
eb0afd1e50dc1c7fb74af0ad29526d233c20373434645edf2624cde886c47ff1
|
|
| MD5 |
b328199bed4a7caff756c4b91d2da0f0
|
|
| BLAKE2b-256 |
442c8e96a8be8da28dfd14f33b009705bcc59f7f8881ccc00038ab05c7e368f9
|
Provenance
The following attestation bundles were made for suqo-0.2.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.2.0-py3-none-any.whl -
Subject digest:
eb0afd1e50dc1c7fb74af0ad29526d233c20373434645edf2624cde886c47ff1 - Sigstore transparency entry: 2461300724
- Sigstore integration time:
-
Permalink:
Code-Pros-AI/suqo-sdk-python@ee3cc90df08c01eee9531d30b4e41fad978851bd -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Code-Pros-AI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ee3cc90df08c01eee9531d30b4e41fad978851bd -
Trigger Event:
release
-
Statement type: