Message

class sdmxthon.model.message.Message(message_type: ~sdmxthon.utils.enums.MessageTypeEnum, payload: (typing.Dict[str, dict], typing.Dict[str, sdmxthon.model.dataset.Dataset], <class 'sdmxthon.model.dataset.Dataset'>, <class 'sdmxthon.model.error.SDMXError'>, typing.Dict[str, sdmxthon.model.submission.SubmissionResult]), header: ~sdmxthon.model.header.Header | None = None)

Bases: object

Message class holds the type of SDMX Message, its payload and its header.

Parameters:
  • message_type (MessageTypeEnum) – Enumeration that withholds the Message type for writing purposes

  • payload (Dataset) – Information stored in the message (Datasets or structures)

  • header (Header) – Header of the message.

property content

Returns the payload as a dict

Class:

Dict

property header

Header of the message.

Class:

Header

property payload

Information stored in the message (DataSet or Structure). A dictionary of datasets could also be used.

Class:

Dataset

Class:

Dict [str, Dataset]

Class:

Structure

set_dimension_at_observation(dim_at_obs)

Sets the dimensionAtObservation if the payload is formed by Datasets

Parameters:

dim_at_obs (str) – Dimension At Observation

to_xml(output_path: str = '', header: Header | None = None, id_: str = 'test', test: str = 'true', prepared: datetime | None = None, sender: str = 'Unknown', receiver: str = 'Not_supplied', prettyprint=True) str

Exports its payload to a XML file in SDMX-ML 2.1 format

Parameters:
  • output_path (str) – Path to save the file, defaults to ‘’

  • prettyprint (bool) – Specifies if the output file is formatted

  • header (Header) – Header to be written, defaults to None

Important

If the header argument is not None, rest of the below arguments will not be used

Parameters:
  • id (str) – ID of the Header, defaults to ‘test’

  • test (str) – Mark as test file, defaults to ‘true’

  • prepared (datetime) – Datetime of the preparation of the Message, defaults to current date and time

  • sender (str) – ID of the Sender, defaults to ‘Unknown’

  • receiver (str) – ID of the Receiver, defaults to ‘Not_supplied’

Returns:

A str, if outputPath is ‘’

property type

Holds the Message type for writing purposes (see to_xml())

MessageTypeEnum

upload_to_fmr(host: str = 'localhost', port: int = 8080, user: str = 'root', password: str = 'password', use_https: bool = False)

Uploads the metadata to the FMR

Parameters:
  • host (str) – Host to be connected

  • port (int) – Port to be used

  • user (str) – Username for basic Auth (Admin or Agency privileges)

  • password (str) – Password for basic Auth

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