Skip to main content

Helpers for scraping the DUME public procurement API

Project description

Tiny helper for downloading the “données essentielles” exposed at https://dume.chorus-pro.gouv.fr/#/accueil/donnees-essentielles/rechercher. Everything here reproduces the JSON calls the official SPA makes to https://dume.chorus-pro.gouv.fr/dumes/donneesEssentielles.

Setup

pip install dume-api

Quick start

import dume_api as dume

# Lightweight list view (same fields as the website table).
rows = dume.get_contracts(date="2024-01-11")

# Add filters the same way you would in the UI.
rows = dume.get_contracts(
    date_start="2024-01-01",
    date_end="2024-01-31",
    cpv_code="45210000",
    type_de="Marché public",
)

# Request the complete contract structure (one API call per reference).
contracts = dume.get_contracts(date="2024-01-05", complete=True)

# Single-contract lookup (used internally by the snippet above).
record = dume.get_contract("AIFEDUME-daoxup8c")

That’s it—you rarely need to instantiate anything else. If you do want to manage your own session (different base URL, manual iteration, etc.), instantiate dume_api.DumeApiClient.

Filters & options

Both helper functions accept the same keyword arguments as the website:

Supported filter keywords and their UI equivalents:

Argument UI label Notes
reference / reference_unique Référence fonctionnelle Exact ref such as AIFEDUME-daoxup8c.
date Date de publication Shortcut that sets both start and end to a single day.
date_start / date_end Date de publication (du/au) YYYY-MM-DD strings; use both to define a range.
internal_id Identifiant interne Matches the ID column returned by the API.
nature Nature Use the exact label (Marché, Contrat de concession, …).
procedure Procédure Exact label shown on the site (Procédure adaptée, etc.).
cpv_code Code CPV Full CPV value (e.g. 45210000).
type_de Type de DE Accepts MP, Marché public, CC, or Contrat de concession.
acheteur_id Acheteur / Autorité concédante Provide the SIRET coming from the autocomplete.
titulaire_id Titulaire / Concessionnaire Provide the SIRET coming from the autocomplete.

Behind the scenes

  • The platform caps each query at 100 rows, so get_contracts() automatically splits large date ranges and toggles between MP/CC when needed. If the API still returns 100 results for a tiny filter the helper raises an error so you can narrow it manually.
  • Each HTTP request retries on 429/5xx responses, backing off exponentially. Call dume.configure_client(pause=0.5, max_retries=5) to slow down or override the defaults.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dume_api-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dume_api-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file dume_api-0.1.0.tar.gz.

File metadata

  • Download URL: dume_api-0.1.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.13

File hashes

Hashes for dume_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ab8aafc2c71072628d81cd7f7f88d6931c0a28c1bc516b3f1b226a6262fa3600
MD5 8ef7c9de616ab866b894ebf559e34be0
BLAKE2b-256 6f33fc5bd88a19485750a918ec0e740af22e71c05c17768b71bb412bcdc043d8

See more details on using hashes here.

File details

Details for the file dume_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dume_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.13

File hashes

Hashes for dume_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af7ca28e3e5cada9e2d117231b525d248c9747ca230d9da75dc582498a58ceb2
MD5 e5980b812a01560f6d12bc24dd95ab6a
BLAKE2b-256 a6b930be11ca6960bd22396d6c630d1b06a30d1544c8d2c7e2c9808ec0593268

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page