Python client for the Subnoto Public API
Project description
Subnoto Python SDK
Python client for the Subnoto Public API.
Table of contents
Installation
Requirements: Python 3.9+
Install from PyPI:
pip install subnoto-api-client
Usage
The SDK provides both async and sync clients. Use SubnotoClient for async/await code
or SubnotoSyncClient for synchronous code. Credentials are required; you can pass
them explicitly or set SUBNOTO_ACCESS_KEY and SUBNOTO_SECRET_KEY.
Async Example
import asyncio
from subnoto_api_client import SubnotoClient, SubnotoConfig
async def main():
async with SubnotoClient(SubnotoConfig()) as client:
response = await client.post("/public/workspace/list", json={})
print(f"Workspaces: {response.json()}")
if __name__ == "__main__":
asyncio.run(main())
Sync Example
from subnoto_api_client import SubnotoSyncClient, SubnotoConfig
with SubnotoSyncClient(SubnotoConfig()) as client:
response = client.post("/public/workspace/list", json={})
print(f"Workspaces: {response.json()}")
Configuration
| Option | Type | Required | Description |
|---|---|---|---|
access_key |
str | Yes | API access key (or set env var SUBNOTO_ACCESS_KEY) |
secret_key |
str | Yes | API secret key, hex-encoded (or set env var SUBNOTO_SECRET_KEY) |
Error handling and tunnel retry
The SDK follows the Subnoto error reference.
On tunnel 401 errors (TUNNEL_SESSION_NOT_FOUND or TUNNEL_ERROR), the client automatically
invalidates the tunnel session and retries the request up to 3 times with a new session.
You do not need to manage tunnel lifecycle when using SubnotoClient or SubnotoSyncClient.
For custom handling you can use the exported helpers and codes. You can raise
SubnotoError(message, response.status_code) with the response body message and status code.
from subnoto_api_client import (
SubnotoClient,
SubnotoConfig,
get_error_code,
is_tunnel_error,
SubnotoError,
TUNNEL_SESSION_NOT_FOUND,
TUNNEL_ERROR,
)
async def main():
async with SubnotoClient(SubnotoConfig()) as client:
response = await client.post("/public/utils/whoami", json={})
if response.status_code != 200:
body = response.json()
code = get_error_code(body) # works with API shape (error.code) and top-level code
if is_tunnel_error(body):
# SDK already retried (up to 3 times); this is the result after retries
pass
msg = body.get("error", {}).get("message", str(body)) if isinstance(body, dict) else str(body)
raise SubnotoError(msg, response.status_code)
See the Subnoto error reference for all error codes.
Documentation
The API documentation is available here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 subnoto_api_client-2.14.4-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: subnoto_api_client-2.14.4-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
164164e6be12b490383a5e48f00e8bea10de86f5cce201c6cf811c9081dc35e3
|
|
| MD5 |
663d59914dae458cb8cca3b72edd823b
|
|
| BLAKE2b-256 |
4956654ddbc7986d1630fdad26a57610ce34da1a2f887213cd217c989c78489d
|
Provenance
The following attestation bundles were made for subnoto_api_client-2.14.4-cp311-abi3-win_amd64.whl:
Publisher:
.gitlab-ci.yml on subnoto/subnoto-monorepo-public
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
subnoto_api_client-2.14.4-cp311-abi3-win_amd64.whl -
Subject digest:
164164e6be12b490383a5e48f00e8bea10de86f5cce201c6cf811c9081dc35e3 - Sigstore transparency entry: 1369650716
- Sigstore integration time:
-
Permalink:
subnoto/subnoto-monorepo-public@37d9f4cd1c4f6dd6dba97cb46b3b49a274e6afee -
Branch / Tag:
refs/tags/v2.14.4 - Owner: https://gitlab.com/subnoto
-
Access:
public
-
Token Issuer:
https://gitlab.com -
Runner Environment:
gitlab-hosted -
Publication workflow:
.gitlab-ci.yml@37d9f4cd1c4f6dd6dba97cb46b3b49a274e6afee -
Trigger Event:
push
-
Statement type:
File details
Details for the file subnoto_api_client-2.14.4-cp311-abi3-manylinux2014_x86_64.whl.
File metadata
- Download URL: subnoto_api_client-2.14.4-cp311-abi3-manylinux2014_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.11+
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da8d2acd7b1ca92b46d68c5fb0e67330bdcd2cc42e988c39c006e8b5218998b8
|
|
| MD5 |
4fc5ae6d49217f8f6d9177352caea630
|
|
| BLAKE2b-256 |
b5a6d1cd8b96bc9c86cbd0965ffe0fd94179ffc17f9e0d3193efd22f656b9ebb
|
Provenance
The following attestation bundles were made for subnoto_api_client-2.14.4-cp311-abi3-manylinux2014_x86_64.whl:
Publisher:
.gitlab-ci.yml on subnoto/subnoto-monorepo-public
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
subnoto_api_client-2.14.4-cp311-abi3-manylinux2014_x86_64.whl -
Subject digest:
da8d2acd7b1ca92b46d68c5fb0e67330bdcd2cc42e988c39c006e8b5218998b8 - Sigstore transparency entry: 1369650618
- Sigstore integration time:
-
Permalink:
subnoto/subnoto-monorepo-public@37d9f4cd1c4f6dd6dba97cb46b3b49a274e6afee -
Branch / Tag:
refs/tags/v2.14.4 - Owner: https://gitlab.com/subnoto
-
Access:
public
-
Token Issuer:
https://gitlab.com -
Runner Environment:
gitlab-hosted -
Publication workflow:
.gitlab-ci.yml@37d9f4cd1c4f6dd6dba97cb46b3b49a274e6afee -
Trigger Event:
push
-
Statement type:
File details
Details for the file subnoto_api_client-2.14.4-cp311-abi3-manylinux2014_aarch64.whl.
File metadata
- Download URL: subnoto_api_client-2.14.4-cp311-abi3-manylinux2014_aarch64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.11+
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2333d1714a7f1ca32e26a6a7b98c15f01229c5ad04da3c9288a2ab2d0a585ac6
|
|
| MD5 |
6a65160f7f8222d786b6ee34cef90208
|
|
| BLAKE2b-256 |
54efef53d591e09c21eb906a805700f1b55e66b64b50f07eebfee64ce872cbee
|
Provenance
The following attestation bundles were made for subnoto_api_client-2.14.4-cp311-abi3-manylinux2014_aarch64.whl:
Publisher:
.gitlab-ci.yml on subnoto/subnoto-monorepo-public
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
subnoto_api_client-2.14.4-cp311-abi3-manylinux2014_aarch64.whl -
Subject digest:
2333d1714a7f1ca32e26a6a7b98c15f01229c5ad04da3c9288a2ab2d0a585ac6 - Sigstore transparency entry: 1369650513
- Sigstore integration time:
-
Permalink:
subnoto/subnoto-monorepo-public@37d9f4cd1c4f6dd6dba97cb46b3b49a274e6afee -
Branch / Tag:
refs/tags/v2.14.4 - Owner: https://gitlab.com/subnoto
-
Access:
public
-
Token Issuer:
https://gitlab.com -
Runner Environment:
gitlab-hosted -
Publication workflow:
.gitlab-ci.yml@37d9f4cd1c4f6dd6dba97cb46b3b49a274e6afee -
Trigger Event:
push
-
Statement type:
File details
Details for the file subnoto_api_client-2.14.4-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: subnoto_api_client-2.14.4-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76a92515e8532456d6819b01289ae24cbccfca6db8497db5091a6f008976771c
|
|
| MD5 |
75c15d4459739d6ef137e43762412cae
|
|
| BLAKE2b-256 |
2e1ee8b6bcd0fcd9d500211286dd1807457b86b957f70ee799e714ef3968cb10
|
Provenance
The following attestation bundles were made for subnoto_api_client-2.14.4-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
.gitlab-ci.yml on subnoto/subnoto-monorepo-public
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
subnoto_api_client-2.14.4-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
76a92515e8532456d6819b01289ae24cbccfca6db8497db5091a6f008976771c - Sigstore transparency entry: 1369650441
- Sigstore integration time:
-
Permalink:
subnoto/subnoto-monorepo-public@37d9f4cd1c4f6dd6dba97cb46b3b49a274e6afee -
Branch / Tag:
refs/tags/v2.14.4 - Owner: https://gitlab.com/subnoto
-
Access:
public
-
Token Issuer:
https://gitlab.com -
Runner Environment:
gitlab-hosted -
Publication workflow:
.gitlab-ci.yml@37d9f4cd1c4f6dd6dba97cb46b3b49a274e6afee -
Trigger Event:
push
-
Statement type: