Skip to main content
wbapi

Асинхронный клиент WB API

PyPI version Downloads Tests Coverage Checked with mypy msgspec Ruff Python

Установка

Требуется Python 3.10+.

pip install wbapi-async

Примеры использования

Новые сборочные задания

import asyncio
import os

from wbapi import WBApi


async def main():
    async with WBApi(token="your_token_here") as api:
        response = await api.orders_fbs.get_orders_new()
        for order in response.orders:
            print(f"{order.id}: артикул {order.nm_id}, {order.sale_price / 100:.2f} ₽")


asyncio.run(main())

Поставка FBS

import asyncio
import os

from wbapi import WBApi


async def main():
    async with WBApi(token="your_token_here") as api:
        supply = await api.orders_fbs.create_supply()
        print(f"Создана поставка: {supply.id}")

        new_orders = await api.orders_fbs.get_orders_new()
        order_ids = [order.id for order in new_orders.orders[:10]]
        await api.orders_fbs.update_supplies_order(supply_id=supply.id, orders=order_ids)
        print(f"Добавлено {len(order_ids)} новых сборочных заданий")

        await api.orders_fbs.update_supplies_deliver(supply_id=supply.id)
        print(f"Поставка {supply.id} передана в доставку")


asyncio.run(main())

Пагинация

Клиент поддерживает все существующие схемы пагинации: токен, курсор, rrdId, смещение и подбирает нужную автоматически.

auto_paginate=True собирает все страницы в один список:

import asyncio

from wbapi import WBApi


async def main():
    async with WBApi(token="your_token_here") as api:
        rows = await api.orders_fbs.get_orders(limit=1000, next_=0, auto_paginate=True)
        print(f"Всего заказов: {len(rows)}")


asyncio.run(main())

На больших выборках используйте iter_* методы:

import asyncio

from wbapi import WBApi


async def main():
    async with WBApi(token="your_token_here") as api:
        async for order in api.orders_fbs.iter_get_orders(limit=1000, next_=0):
            print(order.id, order.nm_id)


asyncio.run(main())

Повторы и лимиты

429, 5xx и сетевые сбои повторяются автоматически — с экспоненциальной задержкой, джиттером и учётом заголовка X-Ratelimit-Retry. Лимиты wb соблюдаются по каждому эндпоинту отдельно.

Обработка ошибок

import asyncio
import os

from wbapi import WBApi
from wbapi.exceptions import WBAPIError, WBAuthError, WBRateLimitError


async def main():
    async with WBApi(token="your_token_here") as api:
        try:
            await api.orders_fbs.get_orders_new()
        except WBAuthError:
            print("Токен просрочен или у него нет доступа к нужной категории")
        except WBRateLimitError as error:
            print(f"Превышен лимит, повтор через {error.retry_after} с")
        except WBAPIError as error:
            print(f"{error.status_code}: {error}")


asyncio.run(main())

Песочница

Вы можете протестировать методы API на случайных данных. Для этого понадобится токен с опцией Тестовый контур.

Данные в тестовом контуре сгенерированы случайным образом и не принадлежат реальным продавцам. Использование тестового контура не несёт риска непреднамеренного раскрытия информации.

async with WBApi(token="your_token_here", sandbox=True) as api:
    supply = await api.orders_fbs.create_supply(name="test")

Лицензия

MIT

Metadata

Release files for wbapi-async 1.2.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 wbapi-async 1.2.0
File Size Uploaded
wbapi_async-1.2.0.tar.gz 152.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wbapi-async 1.2.0
File Interpreter ABI Platform
wbapi_async-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 346.7 kB

Release files / wbapi_async-1.2.0.tar.gz

Download URL wbapi_async-1.2.0.tar.gz
Size 152.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9e4134ca219b26a9879bdcc5a45c664a1cb161c491c3bbe5d0888a587f9e7c56
BLAKE2b-256 checksum
How to use checksums
de40f571bc0d838fed570ff56aa23081adc2b5c38256ce50eb982f798170f093
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / wbapi_async-1.2.0-py3-none-any.whl

Download URL wbapi_async-1.2.0-py3-none-any.whl
Size 194.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f789b298b293a7b1672697aa7c3461a278a8406ddaca7a9be054200bd02fc0c
BLAKE2b-256 checksum
How to use checksums
690a0b123b3b103952f3955cdf3661ffa91aba4e98b38d229ccef4978d70b320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.10.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

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