Ozon seller library
Project description
ozon-seller
A library that implements a client for Ozon Seller API.
Features
- common features:
- use dataclasses for all the request and responses
- support for automatic JSON serialization and parsing for all the request and responses, respectively
- implement iterators for the endpoints with pagination
- powerful error handling — for each error is available:
- HTTP status
- Ozon Seller API error code and message
- implemented endpoints:
- Uploading and updating products:
- Upload and update product images:
- endpoint:
POST /v1/product/pictures/import - module: ozon_seller.product_pictures_import
- endpoint:
- Get a description of the product characteristics:
- endpoint:
POST /v4/product/info/attributes - module: ozon_seller.product_info_attributes
- endpoint:
- Get product description:
- endpoint:
POST /v1/product/info/description - module: ozon_seller.product_description
- endpoint:
- Upload and update product images:
- Prices and Stocks:
- Update the quantity of products in stock:
- endpoint:
POST /v2/products/stocks - modules:
- endpoint:
- Information about product quantity:
- endpoint:
POST /v4/product/info/stocks - module: ozon_seller.stocks
- endpoint:
- Update prices:
- endpoint:
POST /v1/product/import/prices - module: ozon_seller.product_import_prices
- endpoint:
- Update the quantity of products in stock:
- Promotions:
- Available promotions:
- endpoint:
GET /v1/actions - module: ozon_seller.actions
- endpoint:
- Products that can participate in a promotion:
- endpoint:
POST /v1/actions/candidates - module: ozon_seller.actions_candidates
- endpoint:
- Products in a promotion:
- endpoint:
POST /v1/actions/products - module: ozon_seller.actions_products
- endpoint:
- Available promotions:
- FBS and rFBS orders processing:
- Shipments list (version 3):
- endpoint:
POST /v3/posting/fbs/list - module: ozon_seller.posting_fbs_list
- endpoint:
- Get shipment details by identifier (version 3):
- endpoint:
POST /v3/posting/fbs/get - module: ozon_seller.posting_fbs_get
- endpoint:
- List of manufacturing countries:
- endpoint:
POST /v2/posting/fbs/product/country/list - module: ozon_seller.posting_fbs_product_country_list
- endpoint:
- Set the manufacturing country:
- endpoint:
POST /v2/posting/fbs/product/country/set - module: ozon_seller.posting_fbs_product_country_set
- endpoint:
- Print the labeling:
- endpoint:
POST /v2/posting/fbs/package-label - module: ozon_seller.posting_fbs_package_label
- endpoint:
- Shipments list (version 3):
- FBO:
- Shipments list:
- endpoint:
POST /v2/posting/fbo/list - module: ozon_seller.posting_fbo_list
- endpoint:
- Shipments list:
- FBS delivery:
- Create an acceptance and transfer certificate and a waybill:
- endpoint:
POST /v2/posting/fbs/act/create - module: ozon_seller.posting_fbs_act_create
- endpoint:
- List of shipments in the certificate:
- endpoint:
POST /v2/posting/fbs/act/get-postings - module: ozon_seller.fbs_act_get_postings
- endpoint:
- Barcode for product shipment:
- endpoint:
POST /v2/posting/fbs/act/get-barcode - module: ozon_seller.posting_fbs_act_get_barcode
- endpoint:
- Status of acceptance and transfer certificate and waybill:
- endpoint:
POST /v2/posting/fbs/act/check-status - module: ozon_seller.posting_fbs_act_check_status
- endpoint:
- Create an acceptance and transfer certificate and a waybill:
- Chats with customers:
- Send message:
- endpoint:
POST /v1/chat/send/message - module: ozon_seller.chat_send_message
- endpoint:
- Create a new chat:
- endpoint:
POST /v1/chat/start - module: ozon_seller.chat_start
- endpoint:
- Send message:
- outdated endpoints:
- ???:
- endpoint:
POST /v2/product/info - module: ozon_seller.product_info
- endpoint:
- ???:
- endpoint:
POST /v2/returns/company/fbo - module: ozon_seller.returns_fbo
- endpoint:
- ???:
- endpoint:
POST /v2/returns/company/fbs - module: ozon_seller.returns_fbs
- endpoint:
- ???:
- endpoint:
POST /v3/posting/fbs/ship - module: ozon_seller.posting_fbs_ship_gtd
- endpoint:
- ???:
- Uploading and updating products:
Installation
From PyPI
Install the library from PyPI:
$ python3 -m pip install ozon-seller
From source
Clone this repository:
$ git clone https://github.com/irenicaa/ozon-seller
$ cd ozon-seller
Then install the library:
$ make install
Examples
Information about product quantity:
import sys
import os
import os.path
import logging
# requires: python3 -m pip install "python-dotenv >= 0.7.1, < 1.0.0"
import dotenv
from ozon_seller.common import credentials, http_error
from ozon_seller import stocks
def _run_request(credentials: credentials.Credentials, logger: logging.Logger) -> None:
data = stocks.PaginatedProductFilter(
filter=stocks.ProductFilter(
visibility="VISIBLE",
),
cursor="",
limit=1000,
)
logger.info("request payload: %s", data.to_json())
for item in stocks.get_product_info_stocks_iterative(credentials, data):
logger.info("stock item: %r", item)
if __name__ == "__main__":
logging.basicConfig(format="%(asctime)s [%(levelname)s] %(message)s", level=logging.INFO)
dotenv.load_dotenv()
logger = logging.getLogger(__name__)
try:
request_credentials = credentials.Credentials(
os.getenv("OZON_CLIENT_ID", ""),
os.getenv("OZON_API_KEY", ""),
)
_run_request(request_credentials, logger)
except http_error.HTTPError as error:
logger.error("HTTP error occurred: status = %d; message = %r", error.status, error.message)
logger.error("HTTP error occurred: response data = %r", error.response_data)
License
The MIT License (MIT)
Copyright © 2025 irenica
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
ozon_seller-1.0.0.tar.gz
(44.9 kB
view details)
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 ozon_seller-1.0.0.tar.gz.
File metadata
- Download URL: ozon_seller-1.0.0.tar.gz
- Upload date:
- Size: 44.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccbba4cab3956ab5ebf667236e31558b4f3a61ac28b31a21b313edd0c37e746b
|
|
| MD5 |
1d4e54d040b092bd6f5b63c1e63b18a6
|
|
| BLAKE2b-256 |
44da6e9cf887abea291ae835aba6a46e48f53f4ce203dec5b34a58bf35606aaa
|
File details
Details for the file ozon_seller-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ozon_seller-1.0.0-py3-none-any.whl
- Upload date:
- Size: 60.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4bd5bbac904c61a8f177951e6c300cf9135831ea32ae0e36e005c729da2b1c2
|
|
| MD5 |
a6e8a32da6032a576b7ed72c833c0f86
|
|
| BLAKE2b-256 |
024b1a29e594fd1c06f4ff7ad10d597179407a97c67d6b778a479389d768f3d6
|