Skip to main content

tamga-python

PyPI version CI codecov

Official Python SDK for Tamga. Integrate license activation, offline verification, and machine management into your Python applications.

Pure Python — no Rust extension, no native build step. Every cryptographic primitive (Ed25519, RSA-PKCS1/PSS, ECDSA-P256, AES-256-GCM, HKDF) is implemented natively via the cryptography package; HTTP transport is httpx.

Install

pip install tamga-sdk

Published to PyPI as tamga-sdk (the bare tamga name is taken by an unrelated logging library); the importable package name is tamga.

Quickstart

from tamga import TamgaClient, TamgaConfig

client = TamgaClient(
    TamgaConfig(account_id="your-account-id", host="api.tamga.sh"),
)

result = client.licenses.validate_by_key("YOUR-LICENSE-KEY")

if result.meta.valid:
    print("License is valid:", result.meta.code)
else:
    print("License is not valid:", result.meta.code, result.meta.detail)

More examples in examples/:

Auth transports

The SDK supports 4 of the server's 5 documented auth transports (session-cookie auth is browser/portal-only and out of scope for a non-browser SDK):

from tamga.transport import BasicAuth, BearerAuth, LicenseAuth, QueryParamAuth

# 1. Bearer token (SDK default when default_auth is set to one)
TamgaConfig(account_id="...", host="...", default_auth=BearerAuth(token="tok-..."))

# 2. HTTP Basic — three sub-forms
TamgaConfig(
    account_id="...", host="...", default_auth=BasicAuth(email="you@example.com", password="...")
)
TamgaConfig(account_id="...", host="...", default_auth=BasicAuth(token="tok-..."))
TamgaConfig(account_id="...", host="...", default_auth=BasicAuth(license_key="..."))

# 3. License key — the primary transport for embedded/client apps
TamgaConfig(account_id="...", host="...", default_auth=LicenseAuth(key="YOUR-LICENSE-KEY"))

# 4. Query parameter
TamgaConfig(account_id="...", host="...", default_auth=QueryParamAuth(value="tok-..."))

licenses.validate_by_key(key) always sends Authorization: License <key> for the key being validated, regardless of default_auth, since it already has the credential in hand.

Offline verification

.lic license files and machine files can be verified fully offline once the account's public key is embedded in your application — no network round-trip required on every check:

from tamga.checkout.license_file import LicenseFile

certificate = client.licenses.check_out(license_id, as_bytes=True)
license_file = LicenseFile.parse(certificate.decode())
license_resource = license_file.verify(public_key=YOUR_ED25519_PUBLIC_KEY_BYTES)

See examples/checkout_and_verify.py for the full flow, including encrypted checkout.

What this SDK does not do

Per tamga-api's Known Server-Side Gaps: no client-side rate-limit/backoff handling (the server never returns 429), no Tamga-Environment header, no release/auto-update checking (GET /releases/actions/upgrade is unusable server-side today). See CLAUDE.md for the full gotcha list.

Documentation

  • tamga-api docs/sdk.md — the authoritative wire-level protocol reference this SDK implements against, including the Known Server-Side Gaps section describing which documented features are not yet live server-side.
  • CLAUDE.md — dense, gotcha-first architecture/crypto reference for anyone modifying this codebase.
  • SECURITY.md — the crypto assumptions an integrator is trusting, and how to report a vulnerability.
  • CONTRIBUTING.md — dev setup, test/lint/type-check commands, PR expectations.

License

MIT — see LICENSE.

Download files

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

Source Distribution

tamga_sdk-0.1.0.tar.gz (153.4 kB view details)

Uploaded Source

Built Distribution

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

tamga_sdk-0.1.0-py3-none-any.whl (49.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tamga_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a0040f5350024141188d87ea68a5d2038b7680c675d6eac9cb0358b5ef9ccd4
MD5 a6edd21aeb8b8190a13c7f91820f7932
BLAKE2b-256 bddc14271655584ab1d6aff8e2fabb58a1d94f5bcd0aaa6bd687d5f65c2c294b

See more details on using hashes here.

Provenance

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

Publisher: release.yml on tamga-sh/tamga-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 tamga_sdk-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for tamga_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df6a417e9da5a47af40b48d57889827b1735f5016fbe04ae1591573d6fcef5e4
MD5 b9c3c7fe685c5fe28e6eb07bcbffa393
BLAKE2b-256 f839e3ff17fbceef108a9b418dba4861630ece2af72aaefd69dba97ec627e081

See more details on using hashes here.

Provenance

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

Publisher: release.yml on tamga-sh/tamga-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

1.1.1

2 files

1.1.0

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

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