Skip to main content

Usklađenost cijena – Python SDK

Python klijent za API servisa Usklađenost cijena: sidrene cijene i javni strojno čitljiv cjenik po NN 101/2026. Pokriva cijeli API: trgovce, lokacije i kanale, katalog, cijene, odluke o usklađenosti, objave cjenika, uvoz datoteka i webhookove, uz provjeru potpisa webhook isporuka.

pip install uskladjenost-cijena

Python 3.9+, jedina ovisnost je requests. API token (pc_live_… ili pc_test_…) izdajete u aplikaciji pod API pristup; token nosi opsege (scopes).

Brzi početak

from uskladjenost_cijena import Client

api = Client(os.environ["PC_TOKEN"])

# 1. Artikl po vašoj šifri (catalog:write); odgovor nosi offer_id
item = api.items.upsert("SKU-1", merchant_id=merchant_id, kind="product", name="Deterdžent 3 kg", barcode="3859000000001", fmcg_category="cleaning")

# 2. Cijena po vašoj šifri, bez offer_id-a (prices:write); iznosi u centima
api.prices.record_by_external("SKU-1", regular_price_minor=1250, effective_price_minor=990, location_code="PU-01", idempotency_key="order-42-line-1")

# 3. Što ispisati uz cijenu (compliance:read)
decision = api.compliance.by_external("SKU-1", location_code="PU-01")
print(decision["data"]["anchor_display"]["label"])  # "Cijena na dan 10. 9. 2026.: 12,50 €" ili None

Sve metode

Resurs Metoda Poziv Opseg
— ping() GET /api/v1/ping —
merchants list() GET /merchants catalog:read
upsert(key, **data) PUT /merchants/{key} catalog:write
locations(merchant_id) / channels(merchant_id) GET /merchants/{id}/locations / channels catalog:read
upsert_location(merchant_id, code, **data) / upsert_channel(...) PUT /merchants/{id}/locations/{code} catalog:write
items list(**filters) / all(**filters) GET /items (kursor) catalog:read
get(external_id, merchant_id=None, source_system=None) GET /items/{id} catalog:read
upsert(external_id, **data) / bulk(items) PUT /items/{id} / POST /items/bulk catalog:write
prices record(offer_id, idempotency_key=None, **event) POST /offers/{id}/price-events prices:write
record_by_external(external_id, location_code=..., **event) POST /prices/by-external/{id} prices:write
bulk(events) POST /price-events/bulk prices:write
history(offer_id, since=None, cursor=None, limit=None) GET /offers/{id}/price-events prices:read
offers get(offer_id) GET /offers/{id} prices:read
compliance for_offer(offer_id, at=None, locale=None) GET /offers/{id}/compliance compliance:read
by_external(external_id, **scope) GET /compliance/by-external/{id} compliance:read
query(offer_ids, at=None, locale=None) POST /compliance/query compliance:read
list(**filters) / all(**filters) GET /compliance compliance:read
publications scopes() / status(scope_id) GET /publication-scopes publications:read
publish(scope_id) POST /publication-scopes/{id}/publish publications:manage
imports upload(merchant_id, type, file, filename, on_conflict=None, dry_run=None) POST /imports imports:write
get(import_id) GET /imports/{id} imports:write
webhooks list() / create(url, events, description=None) / test(id) / delete(id) /webhooks webhooks:manage

Svaka metoda vraća dekodirani JSON kao dict (data, next_cursor, summary…) plus _status. Odbijanje API-ja je ApiError s code (npr. validation, not_found, ambiguous, insufficient_scope), status i details.

Webhookovi

from uskladjenost_cijena import webhooks

event = webhooks.event(secret, request.headers, request.get_data())  # ValueError ako potpis ne drži
if event["event"] == "publication.failed":
    ...

Razvoj

pip install -e .[dev] && pytest

Dokumentacija API-ja: https://uskladjenost-cijena.com/api/docs i /api/swagger. Licenca MIT, © Info Media d.o.o.

Ostali SDK-ovi i dodaci

Ista obitelj za isti API, svaki u svom repozitoriju:

Release files for uskladjenost-cijena 1.0.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 uskladjenost-cijena 1.0.1
File Size Uploaded
uskladjenost_cijena-1.0.1.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for uskladjenost-cijena 1.0.1
File Interpreter ABI Platform
uskladjenost_cijena-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.0 kB

Release files / uskladjenost_cijena-1.0.1.tar.gz

Download URL uskladjenost_cijena-1.0.1.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
157faf462e02fb64b4aaa13d5a09f8ccbab856a3a5bc87d72fbd55b93e725783
BLAKE2b-256 checksum
How to use checksums
834a54f1e50452986ceb9544d4d8b09d15ba62143b6dc1b95ca0bd2307836290
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / uskladjenost_cijena-1.0.1-py3-none-any.whl

Download URL uskladjenost_cijena-1.0.1-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ce238395d27d1bd8cb22256ceff68f3447a9cd42362d8f249163cd542975c22
BLAKE2b-256 checksum
How to use checksums
6254937fdbfc366393dfd5c34088176e5f26fc1c4b9450b20cf6897c89a6e36a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

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