dicogis.cli.cmd_publish module

class dicogis.cli.cmd_publish.PublishReport(published=0, ignored=0, failed=0, errors=<factory>)

Bases: object

Outcome of a publish_metadata_folder() run.

__init__(published=0, ignored=0, failed=0, errors=<factory>)
errors: list[str]
failed: int = 0
ignored: int = 0
published: int = 0
property total: int

Total number of JSON files examined.

dicogis.cli.cmd_publish.publish(input_folder=None, udata_api_key=None, udata_api_url_base='https://demo.data.gouv.fr/api/', udata_api_version='1', udata_organization_id=None, opt_notify_sound=True, verbose=False)

Publish metadata (previously exported as JSON files) to a catalog.

dicogis.cli.cmd_publish.publish_metadata_folder(input_folder, udata_api_key, udata_api_url_base='https://demo.data.gouv.fr/api/', udata_api_version='1', udata_organization_id=None, progress_callback=None, verbose=False)

Publish every DicoGIS metadata JSON file within a folder to a uData catalog.

This is the core, UI-agnostic logic shared by the dicogis-cli publish command and the GUI’s “Publish” tab.

Parameters:
  • input_folder (Path) – folder where metadata JSON files (udata flavor) are stored.

  • udata_api_key (str) – API key of the account on the uData instance.

  • udata_api_url_base (str) – API URL of the uData instance.

  • udata_api_version (str) – API version of the uData instance.

  • udata_organization_id (Optional[str]) – organization ID in the uData instance. If set, datasets are added to the organization instead of the user authenticated with the API key.

  • progress_callback (Optional[Callable[[int, int, Path], None]]) – called after each JSON file has been examined, with (files_done, files_total, current_json_file).

  • verbose (bool) – log ignored files (not DicoGIS or already published) at info level.

Raises:
Return type:

PublishReport

Returns:

counters and per-file error messages for the run.