Skip to main content

Official Python SDK for the MEOK Attestation API — sign + verify HMAC-signed compliance attestations across the MEOK trade-compliance ecosystem.

Project description

meok-sdk

Official Python SDK for the MEOK Attestation API — sign + verify HMAC-signed compliance attestations across the MEOK trade-compliance ecosystem.

Part of the MEOK AI Labs ecosystem powering haulage.app, the umbrella for 32 PyPI-published Model Context Protocol servers covering UK + EU + US + AU + Canada + air + sea + rail trade compliance.

PyPI Python License: MIT

Install

pip install meok-sdk

Python ≥ 3.10. The only runtime dep is httpx — works in sync + async code, on Vercel Edge, AWS Lambda, anywhere modern Python runs.

Quick start — verify a cert (no API key needed)

from meok_sdk import MeokClient

cert = {  # came from any MEOK MCP tool result
    "cert_id": "...",
    "signature_sha256_hmac": "...",
    "payload": {...}
}

result = MeokClient.verify_public(cert)
print(result.valid, result.message)

The verifier endpoint is public and rate-limited — no auth, no install required beyond this package. That's the whole point: any auditor, regulator, or customer can verify your compliance chain from their machine.

Sign a cert (requires an API key)

Get an API key by upgrading on meok-compliance.vercel.app/pricing or haulage.app/pricing. The key arrives in the welcome email after Stripe checkout.

from meok_sdk import MeokClient

with MeokClient(api_key="sk_meok_…") as client:
    cert = client.sign(
        regulation="EU_AI_ACT_ANNEX_III",
        entity="ACME Haulage Ltd",
        score=82,
        findings=[
            "Tachograph data exported",
            "Driver hours within limits",
            "OCRS forecast GREEN",
        ],
        articles_audited=["Art_9", "Art_10", "Art_15"],
    )
    print(cert["verify_url"])  # share with auditor

You can also pass the key via the MEOK_API_KEY environment variable.

Async usage

import asyncio
from meok_sdk import AsyncMeokClient

async def main():
    async with AsyncMeokClient(api_key="sk_meok_…") as client:
        cert = await client.sign(regulation="GDPR", entity="ACME", score=92)
        verified = await client.verify(cert)
        assert verified.valid

asyncio.run(main())

Error handling

All exceptions inherit from MeokError:

from meok_sdk import (
    MeokAuthError,         # 401 — bad / missing API key
    MeokValidationError,   # 400 — missing fields / bad input
    MeokPaymentError,      # 402 — Stripe session not paid
    MeokAPIError,          # any other non-2xx
    MeokNetworkError,      # connect / DNS / TLS / timeout
    MeokError,             # catch-all base
)

Environment variables

Variable What Default
MEOK_API_KEY Default API key used when none is passed to the client. None
MEOK_API_BASE Override base URL (testing, edge deployments). https://meok-attestation-api.vercel.app

What gets signed

Every cert ships:

  • cert_id — unique id
  • issued_at / expires_at (~1 year)
  • regulation / entity / score / assessment (COMPLIANT / PARTIAL / NON_COMPLIANT)
  • findings / articles_audited / auditor_notes
  • issuer / kid / tier
  • verify_url — a public HTML page anyone can hit
  • signature_sha256_hmac — base64url of HMAC-SHA256 over the canonical-JSON payload

The signing key never leaves the server. The verifier re-derives the canonical bytes and re-computes the HMAC; if they match, the cert holds.

Related

License

MIT — © 2026 MEOK AI Labs / CSOAI LTD.

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

meok_sdk-3.1.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

meok_sdk-3.1.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file meok_sdk-3.1.0.tar.gz.

File metadata

  • Download URL: meok_sdk-3.1.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for meok_sdk-3.1.0.tar.gz
Algorithm Hash digest
SHA256 dc1b12aa4ad9497cf3233d8b05cb53c3c359e4af9d5fad7412411d12600e42fc
MD5 a15b1f957df5df0bd7e11e861592385d
BLAKE2b-256 fd732cdfc586db64a680ed71d5498f2556a3a7651b2c742ee7f959aafe45bbba

See more details on using hashes here.

File details

Details for the file meok_sdk-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: meok_sdk-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for meok_sdk-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bf8a2b126432d50b8a4e25ae405c7365c5b91deb88469abe2763060e9e33369
MD5 461f0c3b49409b1e7fdcee1883320b37
BLAKE2b-256 cd7818de40f4cc0b5dc55f5d3f452b41fa68d55d637cd454d06dcbabcf92c3b1

See more details on using hashes here.

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