Skip to main content

avetrust (Python)

SDK Python officiel d'AveTrust — vérification d'identité de niveau forensique (eKYC). Sessions de vérification, résultats, webhooks signés, streaming temps réel et sandbox.

Installation

Distribué via le registry public d'AveTrust :

pip install avetrust --index-url https://gitlab.avepay.net/api/v4/projects/42/packages/pypi/simple

Python ≥ 3.9. Une seule dépendance : httpx.

Démarrage rapide

from avetrust import AveTrust

av = AveTrust("sk_test_…")  # clé test → sandbox (gratuit, déterministe)

v = av.verifications.create(
    checks=["DOCUMENT", "LIVENESS", "FACE_MATCH"],
    callback_url="https://mon-app/kyc/webhook",
    simulate="approved",  # ignoré hors sandbox
)

av.verifications.send_link(
    v.id, channel="EMAIL", to="client@exemple.com",
    link=f"https://verify-test.avetrust.net/s/{v.token}",
)

Recevoir le résultat (webhook)

Vérifiez toujours la signature (corps brut requis) :

# Exemple Flask
@app.post("/kyc/webhook")
def webhook():
    try:
        event = av.webhooks.construct_event(
            request.get_data(),  # bytes bruts
            request.headers.get("X-AveTrust-Signature"),
            os.environ["AVETRUST_WEBHOOK_SECRET"],
        )
    except Exception:
        return "", 400

    if not event["livemode"]:
        return "", 200  # événement sandbox

    if event["data"]["decision"]["outcome"] == "APPROVED":
        activate_account(event["data"].get("externalUserId"))
    return "", 200

Suivi en temps réel (SSE, sans polling)

result = av.verifications.stream(
    v.token,
    on_progress=lambda e: print("étape :", e["step"]),
    on_status=lambda e: print("statut :", e["status"]),
)
print("verdict :", result["status"])  # APPROVED | REVIEW | REJECTED

Sandbox

Une clé sk_test_… : aucun appel réel, gratuit, non facturé, verdict déterministe via simulate. Webhooks avec livemode=False.

av = AveTrust("sk_test_…")
assert av.is_test_mode
v = av.verifications.create(checks=["DOCUMENT"], simulate="rejected")

Erreurs typées

from avetrust import AuthenticationError, RateLimitError, AveTrustError

try:
    av.verifications.create()
except AuthenticationError:
    ...  # clé invalide
except RateLimitError:
    ...  # quota
except AveTrustError as e:
    print(e.code, e.status, e.request_id)

API

Méthode Description
verifications.create(...) Crée une session (renvoie id + token)
verifications.retrieve(id) Résumé
verifications.result(id) Résultat complet
verifications.list(...) Liste paginée (status, test)
verifications.stream(token, ...) Suivi temps réel (SSE)
verifications.send_link(id, ...) Envoie le lien hébergé
verifications.decide(id, outcome) Décision manuelle
api_keys.list() / create(name, env) / revoke(id) Clés
webhooks.construct_event(payload, sig, secret) Vérifie + parse

Licence

© AveTrust — usage réservé.

Metadata

Release files for avetrust 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for avetrust 0.1.0
File Size Uploaded Provenance
avetrust-0.1.0.tar.gz 10.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for avetrust 0.1.0
File Interpreter ABI Platform
avetrust-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.4 kB

Release files / avetrust-0.1.0.tar.gz

Download URL avetrust-0.1.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
23f14cbf66907120831a1cd9871238a8442cbed677e4196027fd5cfb556fb32d
BLAKE2b-256 checksum
How to use checksums
4c81f004538e83d8f4ce3fc3a0f9f84ca3ad3ff077b5ddcb4c7bc0290dd91476
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / avetrust-0.1.0-py3-none-any.whl

Download URL avetrust-0.1.0-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f23ae5f1fb7ea4c2a908beb2f6602d39ac14f3985b36f25ddc6c6e71a40a2508
BLAKE2b-256 checksum
How to use checksums
78b517702661a3fc884d5f4ddf24a54178e81d4c3e530621e1f2e5b696b8595f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for avetrust 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page