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.2.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.2.0
File Size Uploaded
mercapy-2.2.0.tar.gz 97.3 kB Details

Built distribution (wheel)

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

Total release size: 115.6 kB

Release files / mercapy-2.2.0.tar.gz

Download URL mercapy-2.2.0.tar.gz
Size 97.3 kB
Tags Source
SHA-256 checksum
How to use checksums
abf884a4dda8bca9f2d357851cfd1af241262db191ad87832c6ed4af406f0194
BLAKE2b-256 checksum
How to use checksums
495d7b3bf83eaf924d86970b44985d3c0b805dda715622bfc233092322c97ff0
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 Sep 14, 2026.

Transparency log

Release files / mercapy-2.2.0-py3-none-any.whl

Download URL mercapy-2.2.0-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0571f0c2cab67db9ab0f0568aac614454c9ddcc86e796849198e0d4120f9139
BLAKE2b-256 checksum
How to use checksums
69318d5d709c01a5f76e21d34438c1688fd16830aa766ae15afb566718b1ef94
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 Sep 14, 2026.

Transparency log

Release history Release notifications | RSS feed

2.4.0

2 release files

2.3.0

2 release files

This release

2.2.0 This release

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