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.2.0.tar.gz (167.2 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.2.0-py3-none-any.whl (54.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tamga_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 167.2 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.2.0.tar.gz
Algorithm Hash digest
SHA256 1bea6266f3c897aaeb125a9c63925a0257d31ce70e88c92d82e6a8b80186fd1d
MD5 15fbb36193ceb89a46da289cd7a56dd2
BLAKE2b-256 46ae4ab1b76dd0aeff72ace978d9f49ade4a520df1970c46a5fa37f09382ee99

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tamga_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 54.3 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52ff94d50dc70b2a38fb18074b1ad026f9265be100261044c61ee973096e26d7
MD5 8e9ae9c5331cff9e975d2a342d8f25e8
BLAKE2b-256 48ec2ba502d44aa874dea539340e160ee3e31dce3369ad1c0f4b28a361459d83

See more details on using hashes here.

Provenance

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

This release

0.2.0 This release

2 files

0.1.2

2 files

0.1.1

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