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.1.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.1.0
File Size Uploaded
mercapy-2.1.0.tar.gz 95.4 kB Details

Built distribution (wheel)

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

Total release size: 112.7 kB

Release files / mercapy-2.1.0.tar.gz

Download URL mercapy-2.1.0.tar.gz
Size 95.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ebf572e5f41ee4c1db4c426e6f7ea8ae4471e47f630f47e0b6d32ac49856816a
BLAKE2b-256 checksum
How to use checksums
4b793b39adaf74ec959613b56ffa02275649a7d56eac29cadaf7aba31891f9c7
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.1.0-py3-none-any.whl

Download URL mercapy-2.1.0-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11d30190056471705e6e7ce54bf52691d6bbee0ce05c09cb0042ad77f6148255
BLAKE2b-256 checksum
How to use checksums
89249ca5b78178c7f08b890908bc9f3967a3505ccbb9829fa47f673573e75cd5
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

2.2.0

2 release files

This release

2.1.0 This release

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