Skip to content

Documentation

Python SDK: Wildberries: products and regions

ctx.wildberries() is for scenarios built from the ready-made solution. Local methods read settings; network methods retrieve product data.

Examples are fragments inside def run(ctx):. All SDK methods are synchronous; do not add await.

Methods

products

ctx.wildberries().products() -> list[str]

No arguments.

Result: list[str].

Returns product ID strings from scenario settings. This method makes no network request.

result = ctx.wildberries().products()

regions

ctx.wildberries().regions() -> list[dict[str, Any]]

No arguments.

Result: list[dict[str, Any]].

Returns configured regions as { id, name, code } dicts. Pass id, not code, to network methods.

result = ctx.wildberries().regions()

cards

ctx.wildberries().cards(ids, region_id) -> list[dict[str, Any]]

Argument Type Required Purpose
ids list[str] Yes List of authorized identifiers.
region_id str Yes Permitted region identifier, not its display name.

Result: list[dict[str, Any]].

Fetches up to 50 product cards per call for the selected region. Returns an array; a price may be None, and missing cards are omitted.

wb = ctx.wildberries()
regions = wb.regions()
if not regions:
    ctx.abort('Select a collection region')
result = wb.cards(wb.products(), regions[0]['id'])

category_query

ctx.wildberries().category_query() -> str

No arguments.

Result: str.

Returns the category search phrase from scenario settings. No network request is made.

result = ctx.wildberries().category_query()

max_pages

ctx.wildberries().max_pages() -> int

No arguments.

Result: int.

Returns the selected crawl depth, clamped to 1–20 pages.

result = ctx.wildberries().max_pages()

search

ctx.wildberries().search(region_id, page) -> dict[str, Any]

Argument Type Required Purpose
region_id str Yes Permitted region identifier, not its display name.
page int Yes Page number within the configured bound.

Result: dict[str, Any].

Fetches a category search page. The result contains cards, total, and page; the search phrase comes from scenario settings.

wb = ctx.wildberries()
regions = wb.regions()
if not regions:
    ctx.abort('Select a collection region')
result = wb.search(regions[0]['id'], 1)

analogs

ctx.wildberries().analogs(region_id) -> dict[str, Any]

Argument Type Required Purpose
region_id str Yes Permitted region identifier, not its display name.

Result: dict[str, Any].

Discovers new similar products and returns a dictionary with own_id, ids, new_ids, found_now, and query. Call it on every repeated collection.

wb = ctx.wildberries()
regions = wb.regions()
if not regions:
    ctx.abort('Select a collection region')
result = wb.analogs(regions[0]['id'])

details

ctx.wildberries().details(id) -> dict[str, Any]

Argument Type Required Purpose
id str Yes Authorized attachment/product identifier for this context.

Result: dict[str, Any].

Retrieves a product description and characteristics by product ID. A temporarily unavailable card causes an error.

result = ctx.wildberries().details('12345678')

details_many

ctx.wildberries().details_many(ids) -> dict[str, Any]

Argument Type Required Purpose
ids list[str] Yes List of authorized identifiers.

Result: dict[str, Any].

Fetches details for up to 50 product IDs in one call. Returns a dictionary keyed by product ID; temporarily unavailable cards may be missing.

result = ctx.wildberries().details_many(['12345678'])

title

ctx.wildberries().title(card) -> str

Argument Type Required Purpose
card dict[str, Any] Yes An already fetched source card.

Result: str.

Returns the title of a card already fetched. No network request is made.

result = ctx.wildberries().title({'title': 'Product'})

characteristics

ctx.wildberries().characteristics(card) -> dict[str, Any]

Argument Type Required Purpose
card dict[str, Any] Yes An already fetched source card.

Result: dict[str, Any].

Returns the characteristics dict of an already fetched card. Call details(id) first for full characteristics.

result = ctx.wildberries().characteristics({'characteristics': {'size': 'M'}})

Errors and execution context

All calls are synchronous. Invalid arguments or malformed source data can raise ValueError/TypeError; a platform refusal or unavailable service raises RuntimeError. Missing elements/values return None or an empty collection only where explicitly documented. Do not convert every exception into an empty successful result. External-service methods are unavailable in export transformations; see transformation limits and environment.