Skip to main content

mercapy
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 complete Product.
  • 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 None or an empty tuple.
  • request failures raise a MercapyError subclass. library code does not print.
  • connection failures, http 429, and selected 5xx responses use a bounded retry policy.
  • optional request pacing limits how quickly one client starts requests.

documentation

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)

Source distribution for mercapy 2.4.0
File Size Uploaded
mercapy-2.4.0.tar.gz 100.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mercapy 2.4.0
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

2.4.0 This release

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

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