Skip to main content

omnicommerce

Python client for the OmniCommerce API.

The client is generated from the public OpenAPI spec, the same operation map as @omni-commerce/sdk. Sync and async clients take snake_case keyword arguments. Responses are parsed JSON.

Install

Install from PyPI:

python3 -m pip install omnicommerce

Python 3.10+.

Usage

import os
from omnicommerce import Omni

with Omni(api_key=os.environ["OMNI_API_KEY"]) as client:
    products = client.products.list(q="lamp")
    job = client.products.create(
        product={
            "sku": "SKU-100",
            "title": "Sample product",
            "price": 29.9,
            "currency": "SGD",
            "images": ["https://cdn.example.com/product.jpg"],
        }
    )
    created = client.jobs.wait(job_id=job["jobId"])

API keys are organization-scoped. Do not send organization_id on API-key requests.

from omnicommerce import AsyncOmni, Omni, OmniEnvironment

client = Omni(
    api_key="omni_sk_...",
    environment=OmniEnvironment.LOCAL,  # http://localhost:3000
    timeout_in_seconds=60,
    max_retries=2,
)

async with AsyncOmni(api_key=os.environ["OMNI_API_KEY"]) as client:
    products = await client.products.list(q="lamp")

client.with_raw_response.products.get(product_id="prod_123") returns data, status_code, headers, and url.

Review actions

Use client.reviews.reply(review_id="review-uuid", reply="Thank you!") to submit supplied text. Set generate_with_ai=True instead of reply for an AI-generated response; submit=False returns a draft, while submit=True sends it. Optional instructions guide the AI. The review ID goes in the URL; inspect data.submitted for confirmation. Both sync and async clients use this endpoint; the separate draft_reply and actions methods are removed.

Batch market price comparison

Version 0.6.1 adds sync and async products.compare_prices and products.get_price_comparison. Submit up to 50 simple product or variant IDs with a catalog:read credential:

queued = client.products.compare_prices(
    product_ids=["cc87d195-097a-4a5a-8229-cd989ce98d0f"],
)
client.jobs.wait(job_id=queued["jobId"], timeout_in_seconds=1800)
completed = client.products.get_price_comparison(job_id=queued["jobId"])
print(completed["result"]["success"], completed["result"]["results"])

Omit gl to compare all recorded listing markets; gl="sg" restricts research to Singapore. Global Zalora prices stay separate by country/currency. An India Shopify store selling in SGD is researched in Singapore. Read each product's markets array for price evidence, research, comparison, and errors. Missing published price evidence is an explicit failure; a catalog fallback is never a verified listing price. A wait timeout leaves the durable job running. Full comparison guide.

Resources

Client Examples
client.products list, create, get, update, delete, publish, bulk_import, enrich
client.orders list, create, get, update
client.promotions list, create, get, update, delete, sync
client.price_books list, create, get, update, delete, preview
client.aop create, execute, get_config, update_config, retry
client.jobs get, cancel, wait
client.webhooks list, create
client.checkout_sessions create, get, update, complete, cancel
client.ucp.checkout_sessions Universal Commerce Protocol checkout
client.oauth token, revoke

Every other documented tag is exposed the same way.

Errors

from omnicommerce import NotFoundError, Omni, OmniError

try:
    client.products.get(product_id="missing")
except NotFoundError:
    pass
except OmniError as error:
    print(error.status_code, error.body)

Webhooks

from omnicommerce import construct_event

event = construct_event(raw_body, headers, os.environ["OMNI_WEBHOOK_SECRET"])

Signature: HMAC-SHA256 over {timestamp}.{raw_body} compared to X-Omni-Signature.

Regenerate from OpenAPI

From the monorepo root:

yarn sdk:generate

That refreshes src/omnicommerce/_generated/resources.py from docs/openapi.json.

Metadata

Release files for omnicommerce 0.9.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 omnicommerce 0.9.0
File Size Uploaded Provenance
omnicommerce-0.9.0.tar.gz 39.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for omnicommerce 0.9.0
File Interpreter ABI Platform
omnicommerce-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.1 kB

Release files / omnicommerce-0.9.0.tar.gz

Download URL omnicommerce-0.9.0.tar.gz
Size 39.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8109b9c515170402c7e07503d3a2bf6a5ac4793654f6d9ffbff8cc080b35113d
BLAKE2b-256 checksum
How to use checksums
e0a5bb98675f34e3cc0b77776e291853992a33106aec828e277b89e96935bc04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / omnicommerce-0.9.0-py3-none-any.whl

Download URL omnicommerce-0.9.0-py3-none-any.whl
Size 30.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc8c89943c7025c315faabcdca5f1ccb6143b1869b19c4122fe84fae4ed15caa
BLAKE2b-256 checksum
How to use checksums
3dcf555cdf0fabbe31d254aa93d6abebd75d978b65e08196b240add7c4a79c6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for omnicommerce 0.9.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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