Skip to content

ApiConfig

ApiConfig gathers the parameters needed to reach the Legifrance API. It is consumed by LegifranceClient.

FieldTypeDefaultRole
client_idstrPISTE identifier (required)
client_secretstrPISTE secret (required)
token_urlstrPISTE prodOAuth endpoint
api_urlstrLegifrance prodREST base URL
connect_timeoutfloat3.05connect timeout (s)
read_timeoutfloat27.0read timeout (s)
from pylegifrance.config import ApiConfig
# Manual
config = ApiConfig(client_id="...", client_secret="...")
# From the environment (LEGIFRANCE_CLIENT_ID / _SECRET)
config = ApiConfig.from_env()

from_env() loads .env via python-dotenv; see /en/operations/configure-api-credentials.