Skip to main content

rexel-client

Python client for the Rexel Belgium web services - the transport layer for the connector_rexel Odoo addon. It wraps the two Rexel data sources behind one stable surface.

  • SOAP getArticleInformation, getPrices, getBasket on https://services.rexel.be/exchange/ws/prod/rexel (Apache CXF, document/literal).
  • REST rexstand weekly bulk catalog (a zipped dBASE-III .dbf) on …/exchange/rs/prod/netstore/downloads/rexstand.

Install

pip install rexel-client

Usage

from decimal import Decimal
from rexel_client import RexelClient

client = RexelClient(
    customer_number="123456",
    username="…",
    password="…",
    language="NL",       # or "FR"
)

# Article enrichment (descriptions, brand, images, EAN, packaging) — auto-batched ≤100
articles = client.article_get(["NIK70036600"])

# …or matched back to what you asked for: {requested_code: Article}, deduplicated
by_code = client.articles_by_code(["NIK70036600", "E2222407"])

# Live prices + levies + availability for (item_code, quantity) pairs — auto-batched ≤100
prices = client.price_get([("LEG310084", 2)])
prices[0].net_price       # line total for the quantity asked
prices[0].unit_net_price  # net_price / 2, likewise unit_ecotax, unit_recupel, …

# Weekly bulk catalog: the agreed customer assortment with net prices + Belgian levies
items = client.catalog_download()               # -> list[CatalogItem]
raw_zip = client.catalog_download_raw()          # -> bytes, for archival
snapshot = client.catalog_download_snapshot()    # -> raw + sha256 + generated_at + items

Price amounts are line totals

getPrices answers NetPrice, TotalSurcharge, Ecotax, Recupel and Sabam as line totals for the requested quantity; only BasePrice is per unit. Price keeps those raw totals and adds quantity plus unit_net_price, unit_ecotax, unit_recupel, unit_sabam and unit_total_surcharge, not rounded to a money scale, so no caller divides by hand. SOAP rounds levies to 2 decimals per unit before totalling them, so unit_ecotax can differ from the invoice's 4-decimal tariff.

Rows pair with quantities by position. Rexel answers one row per requested line in order, and a reply that does not raises RexelAPIError. The service prices whole quantities: a fractional quantity is truncated, and one below 1 raises ValueError before any call (Rexel would answer quantity 0 with the amounts for 1).

Unknown codes: the two calls disagree

article_get drops a code it does not know (the service answers with an inactive, empty-code record and the client filters it out), so the list can be shorter than what you asked for. price_get returns a row for one instead. Never infer that an item exists from a price row, and never assume either call answers one-to-one with its input.

Rexel also answers getArticleInformation once per requested code, so two identifiers of one product come back twice. articles_by_code() resolves each requested code — by Rexel ref or e-number, case- and whitespace-insensitively — to a single Article. The tolerance is the client's own: codes go on the wire stripped and upper-cased, so it does not rest on the remote service normalising them. Codes differing only in case or spacing are asked once and answered twice — each keeps its own key, holding the same Article. The manufacturer reference is not resolvable: the service returns nothing for it.

getBasket is one-shot

Call it only when you mean to, and keep what it returns. The client never retries it and returns the raw <Content> XML string (basket_get_raw()) so callers can persist it before parsing.

Design notes

  • Money is Decimal everywhere — prices and Belgian levies (ecotax, recupel, sabam, auvibel, bebat) keep exact scale.
  • No lxml / no zeep. The three SOAP operations are document/literal with a fixed namespace; envelopes are built and parsed with the stdlib ElementTree. This mirrors cebeo-client and keeps a compiled dependency out of Odoo workers. The only non-stdlib runtime deps are requests and dbfread.
  • The SOAP response wraps its real payload as an escaped XML string inside a single <return> element (<Root><Status/><Content/></Root>); parsing is two-stage.
  • Status codes: 0 OK · 10–13/20/21 → RexelAuthError · -1/30/99/other → RexelAPIError · transport failures → RexelConnectionError.
  • CatalogSnapshot.catalog_date is the one date the DBF rows agree on. Rows carrying more than one distinct DATE (blank counting as one) raise a ValueError rather than report an arbitrary one — it is refresh and archival metadata. A ZIP holding anything other than exactly one .dbf member is refused for the same reason.
  • The production WSDL is vendored at tests/fixtures/rexel_prod.wsdl — a point-in-time copy of the contract (three operations, no more), with its source and refresh recipe in tests/fixtures/PROVENANCE.md. A test asserts the hand-rolled envelopes match it.

Development

python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
ruff check src tests && ruff format --check src tests
pytest -v

Metadata

Release files for rexel-client 0.3.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 rexel-client 0.3.0
File Size Uploaded Provenance Actions
rexel_client-0.3.0.tar.gz 16.4 kB With provenance Details for rexel_client-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rexel-client 0.3.0
File Interpreter ABI Platform Actions
rexel_client-0.3.0-py3-none-any.whl Python 3 none any Details for rexel_client-0.3.0-py3-none-any.whl

Total release size: 35.9 kB

Release files / rexel_client-0.3.0.tar.gz

Download URL rexel_client-0.3.0.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c4f37e8c9d0a60bc4aedfaed46397a298f0e4c944f0136577aaa1f23185112ed
BLAKE2b-256 checksum
How to use checksums
ec3825e432095e94b914ef42abdfe4446566a1a963cf3810eaab7073c4bb7243
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / rexel_client-0.3.0-py3-none-any.whl

Download URL rexel_client-0.3.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49c4f8a2c2e2d157a892d11e9665848fd2c9c007937e5277d5a63358d6435afb
BLAKE2b-256 checksum
How to use checksums
9604534ecb9d911fd4e652d06291871f54b6253740d37908fd09e0da739c3179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for rexel-client 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rexel_client-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

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