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.1.tar.gz (154.9 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.1-py3-none-any.whl (49.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tamga_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 154.9 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.1.tar.gz
Algorithm Hash digest
SHA256 e044827750da2cd36fe2c7ba382877f857e76813823b929e50fa004e13c1d79f
MD5 90fb6b287755d64cd0598bc86ad6d28d
BLAKE2b-256 7a7bcbc30a1f384d8d344d4ef626e964389ee9919f36ce011474a92df430b02d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tamga_sdk-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: tamga_sdk-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 454db06f8a9d12b02a16011027f0cafb2e51c6a3068e6a971bf886bd43f18246
MD5 f93436066bd0fd26f24a5b65b700977d
BLAKE2b-256 4be06d6fc668e57855088aaf9ebf22d54df06d4c7954d2271586b48c56574f7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tamga_sdk-0.1.1-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

This release

0.1.1 This release

2 files

0.1.0

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