DcpMessage Class

class DcpMessage

Bases: object

Class for handling DCP messages, including fetching and processing them from a remote server using the LDDS protocol.

static get(username: str, password: str, search_criteria: dict | str | Path, host: str, port: int = 16003, timeout: int = 30, tls_mode: int = 1)

Fetches DCP messages from the given LRGS server based on provided search criteria.

This method handles the complete process of connecting to the server, authenticating, sending search criteria, retrieving DCP messages, and finally disconnecting.

Parameters:
  • username – Username for server authentication.

  • password – Password for server authentication.

  • search_criteriaSearch Criteria as a filepath or as a dict.

  • host – Hostname or IP address of the server. Potentially one of the NOAA servers.

  • port – Port number for server connection (default: 16003).

  • timeout – Connection timeout in seconds (default: 30 seconds). Will be passed to socket.settimeout.

  • tls_mode

    TLS configuration level for the connection (default: 1 - DISABLED). Must be one of the following values:

    • 1 - Do not use TLS.

    • 2 - Try to upgrade to TLS via STARTTLS. Continue without TLS if the upgrade fails.

    • 3 - Try to upgrade via STARTTLS. Fail if TLS cannot be established.

    • 4 - Require full TLS before any communication begins.

Returns:

List of DCP messages retrieved from the server.

Raises:
  • ValueError – If tls_mode is not a valid value.

  • TypeError – If search_criteria is not a valid type (dict, str, or Path).

  • Exception – If connection, authentication, or message retrieval fails.