Skip to main content

Official Python client for the A3 Age Assurance API

Project description

a3api

Official Python client for the A3 Age Assurance API.

Typed, async-ready, with built-in retries — supports Python 3.9+.

Installation

pip install a3api

Quick Start

from a3api import A3Client, AssessAgeRequest, OsSignal

client = A3Client(api_key="your-api-key")

response = client.assess_age(AssessAgeRequest(
    os_signal=OsSignal.AGE_18_PLUS,
    user_country_code="US",
))

print(response.verdict)           # CONSISTENT
print(response.confidence_score)  # 0.95
print(response.verification_token)

Async

from a3api import AsyncA3Client, AssessAgeRequest, OsSignal

async with AsyncA3Client(api_key="your-api-key") as client:
    response = await client.assess_age(AssessAgeRequest(
        os_signal=OsSignal.AGE_18_PLUS,
        user_country_code="US",
    ))

With Behavioral Signals

from a3api import (
    A3Client, AssessAgeRequest, OsSignal,
    BehavioralMetrics, DeviceContext,
)

client = A3Client(api_key="your-api-key")

response = client.assess_age(AssessAgeRequest(
    os_signal=OsSignal.AGE_13_15,
    user_country_code="US",
    behavioral_metrics=BehavioralMetrics(
        avg_touch_precision=0.82,
        scroll_velocity=340.0,
        form_completion_time_ms=12000.0,
    ),
    device_context=DeviceContext(
        os_version="iOS 17.2",
        device_model="iPhone 15",
        is_high_contrast_enabled=False,
        screen_scale_factor=3.0,
    ),
))

Error Handling

from a3api import (
    A3Client, A3AuthenticationError,
    A3RateLimitError, A3ValidationError, A3ConnectionError,
)

try:
    response = client.assess_age(request)
except A3AuthenticationError:
    # Invalid or missing API key (401)
    pass
except A3RateLimitError as e:
    # Too many requests (429) — e.retry_after has the wait time
    pass
except A3ValidationError as e:
    # Bad request (400) — e.validation_errors has details
    pass
except A3ConnectionError:
    # Network or timeout error
    pass

Configuration

client = A3Client(
    api_key="your-api-key",
    base_url="https://api.a3api.io",  # default
    timeout=30.0,                      # seconds, default
    max_retries=2,                     # default
)

License

MIT

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

a3api-0.1.2.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

a3api-0.1.2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: a3api-0.1.2.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for a3api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6364299e1e4f5fba0795fee5b3830e83ef73ed35ae6e2ba7f32d04c80081bb0e
MD5 66b8ec9f40aea4a57a22816cad9d4c6c
BLAKE2b-256 5e41d2ae5c363e1e5340a3eac7bb75e379c1243926e598660925eafc0d72fa7b

See more details on using hashes here.

File details

Details for the file a3api-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: a3api-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for a3api-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9c6c7502d0a6e5ab920f84223d5ec0b03b3fd4965dc8d20800bae8237e900e4c
MD5 fd2cb6da89b3c74eb05723cc619763ba
BLAKE2b-256 250e530d155366f549ff438a993de7d3ac98936925e265b64bdacb24f36b45b6

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