Fusion Metadata Registry Interaction methods

Check Host Availability

sdmxthon.webservices.fmr.check_host_availability(host_url)

Checks if the host is available

Parameters:

host_url – URL to check

Returns:

True if the host is available, False otherwise

Exception:

Exception if the host is not available

Validate SDMX-CSV on FMR

sdmxthon.webservices.fmr.validate_sdmx_csv_fmr(csv_text: str, host: str = 'localhost', port: int = 8080, use_https: bool = False, delimiter: str = 'comma', max_retries: int = 10, interval_time: float = 0.5)

Validates an SDMX CSV file by uploading it to an FMR instance and checking its validation status

Parameters:
  • csv_text (str) – The SDMX CSV text to be validated

  • host (str) – The FMR instance host (default is ‘localhost’)

  • port (int) – The FMR instance port (default is 8080 for HTTP and 443 for HTTPS)

  • use_https (bool) – A boolean indicating whether to use HTTPS (default is False)

  • delimiter (str) – The delimiter used in the CSV file (options: ‘comma’, ‘semicolon’, ‘tab’, ‘space’)

  • max_retries (int) – The maximum number of retries for checking validation status (default is 10)

  • interval_time (float) – The interval time between retries in seconds (default is 0.5)

Exception:

Exception with error details if validation fails

Submit Structures to FMR

sdmxthon.webservices.fmr.submit_structures_to_fmr(sdmx_text: str, host: str = 'localhost', port: int = 8080, user: str = 'root', password: str = 'password', use_https: bool = False)

Uploads the metadata to the FMR

Parameters:
  • sdmx_text (str) – The SDMX text containing structures to be submitted

  • host (str) – FMR instance host (default is ‘localhost’)

  • port (int) – FMR instance port (default is 8080)

  • user (str) – User for Basic Auth (Admin or Agency privileges)

  • password (str) – Password for Basic Auth

  • use_https (bool) – Flag to use or not https

Exception:

Exception with error details if upload fails

Get validation status

sdmxthon.webservices.fmr.get_validation_status(status_url: str, uid: str, max_retries: int = 10, interval_time: float = 0.5)

Gets the validation status of file uploaded using the FMR instance.

Parameters:
  • status_url (str) – The URL for checking the validation status

  • uid (str) – The unique identifier of the uploaded file

  • max_retries (int) – The maximum number of retries for checking validation status (default is 10)

  • interval_time (float) – The interval time between retries in seconds (default is 0.5)

Returns:

The validation status if successful

Exception:

raise an exception if the validation status is not found in the response

Exception:

raise an exception if the current time exceeds the timeout