Skip to main content

Python wrapper for the Antistock Developer API.

Project description

antistock-api

A typed Python wrapper for the Antistock Developer API.

Covers all 88 endpoints across 17 resource groups (orders, products, customers, charges, coupons, FAQs, fraud rules, telegram broadcasts/users, tickets, warehouses, and more).

Install

pip install antistock-api

Requires Python 3.11+.

Quick start

from antistock_api import AntistockClient, OrderStatus

with AntistockClient('your-jwt-token') as client:
    me = client.user.get_current()

    for order in client.orders.iter_all(
        shop_id = 'shop-uuid',
        status_filter = OrderStatus.COMPLETED,
        page_size = 100,
    ):
        print(order)

    client.products.create(
        shop_id = 'shop-uuid',
        body = {'name': 'New product', 'price': 10},
    )

Features

  • Full coverage — every endpoint in the OpenAPI spec, organized by resource (client.orders, client.products, client.warehouses, etc.)
  • Typed — full from __future__ import annotations type hints, py.typed marker, enums for every spec enum
  • Pagination — every list endpoint has a paired iter_all(...) generator that walks all pages
  • Auth — bearer token (string) or callable TokenProvider for dynamic refresh
  • Errors — typed exception hierarchy (AntistockAuthenticationError, AntistockNotFoundError, AntistockRateLimitError, etc.)
  • Retries — exponential backoff on 429 and 5xx, honors Retry-After
  • Context managerwith AntistockClient(...) as client: for clean session shutdown

Auth

from antistock_api import AntistockClient

client = AntistockClient('your-jwt-token')

def get_token() -> str:
    return load_token_from_secrets_manager()

client = AntistockClient(get_token)

Configuration

from antistock_api import AntistockClient

client = AntistockClient(
    'your-jwt-token',
    base_url = 'https://business-api.antistock.io',
    timeout_seconds = 30.0,
    max_retries = 3,
    retry_backoff_seconds = 0.5,
)

Errors

from antistock_api import (
    AntistockClient,
    AntistockNotFoundError,
    AntistockRateLimitError,
)

try:
    client.orders.get('shop-uuid', 'missing-id')

except AntistockNotFoundError as E:
    print('order not found:', E.errors)

except AntistockRateLimitError as E:
    print('rate limited, retry after', E.retry_after_seconds)

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

antistock_api-0.1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

antistock_api-0.1.0-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for antistock_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 412d561e6b0b1b0e5f441d713973e8dee5f871f424b63d6e8a74fc58f657e03e
MD5 6d89495ac4f13a60bb00644742f6fc77
BLAKE2b-256 8774fa5d5c4f4470c281d99409d0a1731f7bd0101d314278fdd2fa9c124eedfa

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on forgivenforget/antistock-api

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

File details

Details for the file antistock_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: antistock_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for antistock_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2478dbf63da2644882ee1a81c9b51db8291eaf5670431cfc077b465848e353dc
MD5 478ec08319b7fa721b8efd7b2bd7efb4
BLAKE2b-256 c3cda587b0f0fa74d09334f8f00edf2b9a0bc2bf54014718ec6fcf8fb1dd6384

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on forgivenforget/antistock-api

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