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.1

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.1
File Size Uploaded Provenance Actions
wbapi_async-1.2.1.tar.gz 153.0 kB With provenance Details for wbapi_async-1.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 347.3 kB

Release files / wbapi_async-1.2.1.tar.gz

Download URL wbapi_async-1.2.1.tar.gz
Size 153.0 kB
Tags Source
SHA-256 checksum
How to use checksums
217ecefc2648fdfadf0dea0e78f4061a43d81271cf49e82545efbde50bc80080
BLAKE2b-256 checksum
How to use checksums
abb2b25561faf398317fd842dcdae00154e6b041c6cb50a9d75a8dcae4ad3cca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 30, 2026.

Transparency log

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

Download URL wbapi_async-1.2.1-py3-none-any.whl
Size 194.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7968e51954d83e8706ededbb6e4d17b2416f054f73a28a818dda134027059d9
BLAKE2b-256 checksum
How to use checksums
9aaf406f39dd4c7614514ecacfb136bb321d4e300220af123f6bf532c27106ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 30, 2026.

Transparency log

Security for wbapi-async 1.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for wbapi_async-1.2.1.tar.gz

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 Oct 30, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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