mercapy
mercapy is a synchronous, typed python client for the public storefront apis used by mercadona's online shop. it returns immutable data and makes network requests only through explicit client methods.
this is an unofficial project. it is not affiliated with, endorsed by, or maintained by mercadona. the upstream apis are undocumented and may change without notice.
installation
mercapy supports cpython 3.11 through 3.14.
python -m pip install mercapy
quick start
resolve a warehouse from a spanish postcode, search for a product, then request the complete product record:
from mercapy import Mercadona
with Mercadona.from_postal_code("28001") as mercadona:
result = mercadona.search_products("leche sin lactosa", page_size=10)
for summary in result.products:
print(summary.name, summary.price.unit)
if result.products:
product = mercadona.get_product(result.products[0].id)
print(product.ean)
print(product.nutrition.ingredients)
from_postal_code() performs one request before it returns the client. if the
warehouse code is already known, construct the client without network access:
from mercapy import Mercadona
with Mercadona("mad3", language="es", timeout=8.0) as mercadona:
categories = mercadona.get_categories()
the client reuses its connections. use a with block to close it after use.
behavior
- client methods make the requests. reading a returned model never performs i/o.
- listing calls return
ProductSummary;get_product()returns a completeProduct. - public models are frozen, slotted dataclasses. collections are tuples, ids are
strings, and numeric prices and quantities use
Decimal. - unknown response fields are ignored. missing optional values become
Noneor an empty tuple. - request failures raise a
MercapyErrorsubclass. library code does not print. - connection failures, http
429, and selected5xxresponses use a bounded retry policy. - optional request pacing limits how quickly one client starts requests.
documentation
- documentation index
- usage guide
- api reference
- generated api reference
- reliability and request behavior
- v1 to v2 migration guide
- contribution guide
- release process
- changelog
mercapy is distributed under the mit license.
Metadata
Release files for mercapy 2.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mercapy-2.4.0.tar.gz | 100.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mercapy-2.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.5 kB
Release files / mercapy-2.4.0.tar.gz
| Download URL | mercapy-2.4.0.tar.gz |
|---|---|
| Size | 100.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2101379aa4f456eb97bb0eb0c00ba66f989fecf56a7326e93f997a5cb83f9f38
|
|
BLAKE2b-256 checksum How to use checksums |
a98848f355ecebc95015c2c86d33cc8bb915f4dc838665f4b598182eac523ff7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 4, 2026.
Transparency logRelease files / mercapy-2.4.0-py3-none-any.whl
| Download URL | mercapy-2.4.0-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b07bf9bc82ffb92fb0967466c2ee352a75c4d2641196a1fe4e225ba4b7979f2
|
|
BLAKE2b-256 checksum How to use checksums |
7edb91a86704c873c7aabf545ede2804a47523105e320ad668976da208527203
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 4, 2026.
Transparency log