Contract-oriented Python client for Wildberries API
Project description
Wildberries Python SDK
Professional, contract-oriented Python client for Wildberries API.
Features
- Async/Sync support - Works with both async and synchronous code using httpx
- Type-safe - Full Pydantic V2 models with validation
- Rate limiting - Intelligent token-based rate limiting with category isolation
- Error handling - Typed exception hierarchy for all API errors
- Registry-based - YAML configuration for easy endpoint extension
- Sandbox/Production - Support for both WB environments
- Pagination - Built-in async/sync page iterators
Installation
pip install wildberries-python-sdk
Or with development dependencies:
pip install wildberries-python-sdk[dev]
Quick Start
Async Client
import asyncio
from wildberries_python_sdk import BaseClient, Registry, RateLimiter, GeneralService
async def main():
registry = Registry("config/endpoints")
ratelimiter = RateLimiter()
client = BaseClient(
token="your-api-token",
registry=registry,
ratelimiter=ratelimiter
)
service = GeneralService(client)
info = await service.get_seller_info()
print(f"Seller: {info.name}")
await client.close()
asyncio.run(main())
Sync Client
from wildberries_python_sdk import SyncClient, Registry, RateLimiter, GeneralService
with SyncClient("token", registry, ratelimiter) as client:
service = GeneralService(client)
info = service.get_seller_info()
print(info.name)
Services
| Service | Description |
|---|---|
GeneralService |
Connection check, news, seller info, user management |
ProductsService |
Categories, product cards, tags |
WarehouseService |
Seller warehouses management |
InventoryService |
Stock management |
PricesService |
Prices and discounts |
MediaService |
Media files upload |
Products API Example
from wildberries_python_sdk import ProductsService
service = ProductsService(client)
# Get categories
categories = await service.get_parent_categories()
for cat in categories.data:
print(f"{cat.id}: {cat.name}")
# Get product cards
cards = await service.get_cards_list(
settings={"cursor": {"limit": 100}}
)
Error Handling
from wildberries_python_sdk import WBAPIError, TooManyRequestsError
try:
result = await service.get_data()
except TooManyRequestsError as e:
print(f"Rate limited! {e.detail}")
except WBAPIError as e:
print(f"API Error {e.status}: {e.detail}")
Configuration
from wildberries_python_sdk import Config, DomainType, set_default_locale
# Set global configuration
set_default_locale("en")
# Or use Config class
config = Config(locale="en", domain=DomainType.SANDBOX)
Development
# Clone and install
git clone https://github.com/wildberries/wildberries-python-sdk
cd wildberries-python-sdk
pip install -e ".[dev]"
# Run tests
pytest tests/
# Type checking
mypy src/
# Linting
ruff check src/
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wildberries_python_sdk-0.1.11.tar.gz.
File metadata
- Download URL: wildberries_python_sdk-0.1.11.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5f544db41762db62ea17b7cab87b04aa0e12671891ba07aa93f491b41ad79a7
|
|
| MD5 |
58a052e2a8b1c89e9e20d53f6e7720cf
|
|
| BLAKE2b-256 |
38314a168476a8a84bb882c8d6283966f37f2e49166f558ba93a1a92bb065290
|
File details
Details for the file wildberries_python_sdk-0.1.11-py3-none-any.whl.
File metadata
- Download URL: wildberries_python_sdk-0.1.11-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e91ff30f401360a0c9a70b7990083e39b3bc3085a48773a0347aa05ad04d598f
|
|
| MD5 |
dff7008af1f99108574219410570b345
|
|
| BLAKE2b-256 |
5e23128d70fb269a1313f0fb7b023ea11a4ca8e4355d577876069784e484991e
|