demarches_simpy.demarche module
- class Demarche(number, profile, id=None, **kwargs)[source]
This class represents a demarche in the demarches-simplifiees.fr API. It is used to retrieve and modify the data of a demarche.
Log header : DEMARCHE
Request Variables (For fetching)
includeRevision -> For fields and annotations
includeInstructeurs -> For instructeurs info
- get_annotations()[source]
Get all annotation of the demarche
- Return type:
dict[str,dict[str,str]]- Returns:
A dict of all annotations, with the label as key and the field as value
{ 'an-annotation' : { 'label' : 'an-annotation', '__typename' : 'type', 'description' : 'Le nom de la personne', 'id' : 'uuid-1234-1234', }, ... }
- get_dossier_infos(limit=100)[source]
Get a list of minimum info about all dossiers, allows you to quickly retrieved all dossier without all their data
- Parameters:
limit (int, optional) – The maximum number of dossiers to retrieve, -1 for no limit (default : 100)
- Return type:
list[tuple[str,int]]- Returns:
A list of tuple containing id and number of each dossier.
[ ('uuid-1234-1234',1234567), (...,...) ]
- get_dossiers(limit=100, dossier_filter=<function Demarche.<lambda>>, background_fetching=False, **dossier_kwargs)[source]
Get all dossier objects
- Parameters:
limit (int, optional) – The maximum number of dossiers to retrieve, -1 for no limit (default : 100)
dossier_filter (Callable[[Dossier],bool], optional) – A function that takes a dossier as parameter and return a boolean, if the function return True, the dossier will be added to the list, otherwise it will be ignored (default : lambda _ : True)
background_fetching (bool, optional) – If set to True, all fields of all dossiers will be fetched while fetching them, this will avoid synchronous fetching of each dossier (default : False) Use this if you want to filter dossiers by other fields than id and number
dossier_kwargs (dict, optional) – A dict of kwargs that will be passed to the dossier constructor (useful for passing default_variables for example)
- Return type:
list[Dossier]- Returns:
A list of all dossiers
Notes
This method will fetch all dossiers, if you want to filter them, use the dossier_filter parameter, by default dossier object contains only number and id, if you want filter them by other fields, you need to set background_fetching to True, this will fetch all fields of all dossiers while fetching them avoiding synchronous fetching of each dossier.
- get_fields()[source]
Get all fields of the demarche
- Return type:
dict[str,dict[str,str]]- Returns:
A dict of all fields, with the label as key and the field as value
{ 'a-field' : { 'label' : 'a-field', '__typename' : 'type', 'description' : 'Le nom de la personne', 'id' : 'uuid-1234-1234', }, ... }