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.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 mercapy 2.3.0
File Size Uploaded
mercapy-2.3.0.tar.gz 99.3 kB Details

Built distribution (wheel)

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

Total release size: 118.4 kB

Release files / mercapy-2.3.0.tar.gz

Download URL mercapy-2.3.0.tar.gz
Size 99.3 kB
Tags Source
SHA-256 checksum
How to use checksums
304e6d5a01be1a0f546210a17a3738faf1ccf5498de974f2f0a449ee11cf9366
BLAKE2b-256 checksum
How to use checksums
26535496cfe2f45171269af31e2ad74f108286891dd0b2811dc9475449950528
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.3.0-py3-none-any.whl

Download URL mercapy-2.3.0-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14761f0a235260d3c51f22a16eb9d4b472680ff89ce1ab1a005dda34fd7973fe
BLAKE2b-256 checksum
How to use checksums
5de4aa8efe9c507f60c51f7d765fd73b85eb904479c7337d7265ab2b816fc871
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

2.4.0

2 release files

This release

2.3.0 This release

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