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.2.tar.gz (161.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.1.2-py3-none-any.whl (51.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tamga_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 161.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.1.2.tar.gz
Algorithm Hash digest
SHA256 52407c0d9d30b5d8ba2594762a47e54cbdd264444f9a3182ae276e6b96e35c71
MD5 532335174beb19052f9c67872a8b38d2
BLAKE2b-256 7325f8ee26c6442e55d2e9b1dde7fffeb519da1c8fdb59f2a1969692ad6a64e9

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tamga_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 51.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.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fd808d197878cb0ef398ce3d823c0e3b7030a26c3776db36d2c655e764c2281d
MD5 c72271b54d4a0e0ac97f143fc390ecf4
BLAKE2b-256 155d12ca36e0760b0617ca7216ee6771eb9f4e78baf03e91d39bb538f6041dda

See more details on using hashes here.

Provenance

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

This release

0.1.2 This release

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