Skip to content

Fond Code

The Code class (in pylegifrance/fonds/code.py) is the facade that exposes the fluent API for searching French codes.

The fond groups the codes (Code civil, Code pénal, Code de commerce…) served via two Legifrance bases:

  • CODE_ETAT — current state of the codes (default);
  • CODE_DATE — historical state at a given date.

By default, searches target articles in force as of today. For a historical search, use .at_date("YYYY-MM-DD") or initialize with Code(client, fond="CODE_DATE").

from pylegifrance import LegifranceClient
from pylegifrance.fonds.code import Code
from pylegifrance.models.code.enum import NomCode
client = LegifranceClient(client_id="...", client_secret="...")
code = Code(client)
# Article 1382 of the Code civil
results = (
code.search()
.in_code(NomCode.CC)
.article_number("1382")
.execute()
)
  • code.search()CodeSearchBuilder (fluent, see /en/concepts/builder-pattern).
  • code.fetch_code(text_id) → consult of an entire LEGITEXT.
  • code.fetch_article(article_id) → article by LEGIARTI.
EnumCodeLEGITEXT
NomCode.CCCode civilLEGITEXT000006070721
NomCode.CPCode pénalLEGITEXT000006070719
NomCode.CCOMCode de commerceLEGITEXT000005634379
NomCode.CTRAVCode du travailLEGITEXT000006072050
NomCode.CPCCode de procédure civileLEGITEXT000006070716
NomCode.CPPCode de procédure pénaleLEGITEXT000006071154

Full list: legifrance.gouv.fr/liste/code?etatTexte=VIGUEUR.