Skip to main content

Supertab Connect SDK

Project description

Supertab Connect SDK

Python SDK for Supertab Connect.

Use this package to obtain Supertab license tokens on the customer side and verify or enforce them on the merchant side.

Installation

pip install supertab-connect-sdk

Requires Python 3.12 or newer.

Customer Usage

Obtain a license token for a resource URL:

import asyncio

from supertab_connect import obtain_license_token


async def main() -> None:
    token = await obtain_license_token(
        client_id="your_client_id",
        client_secret="your_client_secret",
        resource_url="https://example.com/premium/article",
    )

    if token is None:
        print("No token required for this usage")
        return

    print(token)


asyncio.run(main())

The SDK fetches license.xml from the resource origin, finds the best matching <content> entry, and exchanges the client credentials for a license token.

Merchant Usage

Verify and record license-token usage:

import asyncio

from supertab_connect import SupertabConnect, SupertabConnectConfig


async def main() -> None:
    client = SupertabConnect(
        SupertabConnectConfig(
            api_key="your_api_key",
        )
    )

    async with client:
        result = await client.verify_and_record(
            token="your.jwt.token",
            resource_url="https://example.com/premium/article",
            user_agent="Mozilla/5.0",
            request_headers={"Accept": "text/html"},
        )

    if not result.valid:
        print(f"DENY access: {result.error}")
        return

    print("ALLOW access")


asyncio.run(main())

For request-level enforcement, use SupertabConnect.handle_request() with an httpx.Request. See the examples directory for complete merchant and customer examples.

Error Handling

Customer-side token retrieval raises SupertabConnectError when license.xml cannot be fetched or parsed, no matching content block exists, or the token endpoint fails.

Merchant-side token verification returns typed result objects instead of raising for normal invalid-token cases. Invalid tokens include a reason and a human readable error.

Typing

This package ships inline type hints and includes a py.typed marker for type checkers.

Documentation

See the Supertab Connect Python SDK docs for the full API reference.

Development

This project uses hatchling as the build backend.

See DEVELOPMENT.md for local setup, Git hooks, and CI-aligned development commands.

Links

Project details


Download files

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

Source Distribution

supertab_connect_sdk-0.1.0.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

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

supertab_connect_sdk-0.1.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: supertab_connect_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for supertab_connect_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 147d002a24a22fa0121144eeed5bf561d3f882334fc15b58698de63caa9a302f
MD5 dcd3de28b3df1581c1dbf7c4b1c85197
BLAKE2b-256 4221d3f5c9edc1259a125c99ffe41522ea71dbc9cf9c88094489bb216e94a8aa

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.yml on getsupertab/connect-sdk-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 supertab_connect_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for supertab_connect_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7f49ee17d4a50ec3c09434f81b974a072726e471a58cb4d97b932f2e234f326
MD5 8f69fef08180201725b9ba39798a0840
BLAKE2b-256 bbcbe0909b6410e288c5b9919c3c4643041d8b53fa2ddad3c67980ab87efb2b5

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.yml on getsupertab/connect-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page