epicsarchiver_mgmt.archiver.base ================================ .. py:module:: epicsarchiver_mgmt.archiver.base .. autoapi-nested-parse:: Base Archiver HTTP client module. Attributes ---------- .. autoapisummary:: epicsarchiver_mgmt.archiver.base.LOG Exceptions ---------- .. autoapisummary:: epicsarchiver_mgmt.archiver.base.ArchiverError epicsarchiver_mgmt.archiver.base.ArchiverConnectionError epicsarchiver_mgmt.archiver.base.ArchiverResponseError Classes ------- .. autoapisummary:: epicsarchiver_mgmt.archiver.base.BaseArchiverAppliance Functions --------- .. autoapisummary:: epicsarchiver_mgmt.archiver.base.mgmt_url Module Contents --------------- .. py:data:: LOG :type: logging.Logger .. py:function:: mgmt_url(hostname: str, port: int) -> str Generate the mgmt url from a hostname and a port number. :param hostname: fqdn of service :type hostname: str :param port: Port number :type port: int :returns: Completed url, for example "http://localhost:17665/mgmt/bpl/" :rtype: str .. py:exception:: ArchiverError Bases: :py:obj:`epicsarchiver_mgmt.exceptions.BaseMgmtError` Base class for all exceptions raised by the archiver HTTP client. .. py:exception:: ArchiverConnectionError(base_url: str, message: str | None = None) Bases: :py:obj:`ArchiverError` Exception raised when there is a connection error with the archiver. .. py:attribute:: base_url .. py:exception:: ArchiverResponseError(base_url: str, url: str | None = None, response: str | None = None, message: str | None = None) Bases: :py:obj:`ArchiverError` Exception raised when the archiver returns an unexpected response. .. py:attribute:: base_url .. py:attribute:: url :value: None .. py:attribute:: response :value: None .. py:class:: BaseArchiverAppliance(hostname: str = 'localhost', port: int = 17665) Base EPICS Archiver Appliance client. Hold a session to the Archiver Appliance web application. :param hostname: EPICS Archiver Appliance hostname [default: localhost] :param port: EPICS Archiver Appliance management port [default: 17665] .. py:attribute:: hostname :value: 'localhost' .. py:attribute:: port :value: 17665 .. py:attribute:: mgmt_url :value: 'http://localhost:17665/mgmt/bpl/' .. py:attribute:: _info :type: dict[str, str] .. py:attribute:: _data_retrieval_url :type: str | None :value: None .. py:attribute:: session .. py:method:: __repr__() -> str String representation of Archiver Appliance. :returns: details including hostname of Archiver appliance. :rtype: str .. py:method:: _request(method: str, url: str, params: dict[str, str | list[str]] | dict[str, str] | None = None, data: str | dict[str, str] | None = None, json_data: Any | None = None) -> requests.Response Send a request using the session. :param method: HTTP method :param url: The URL to send the request to :param params: Optional arguments :param data: Optional data to be sent :param json_data: Optional JSON data to be sent :returns: :class:`requests.Response ` object :raises ArchiverConnectionError: If there is a connection error. :raises ArchiverResponseError: If the response is not successful. .. py:method:: _get(endpoint: str, params: dict[str, str | list[str]] | dict[str, str] | None = None) -> requests.Response Send a GET request to the given endpoint. :param endpoint: API endpoint (relative or absolute) :param params: Optional arguments to be sent :returns: :class:`requests.Response ` object .. py:method:: _post(endpoint: str, params: dict[str, str | list[str]] | dict[str, str] | None = None, data: str | dict[str, str] | None = None, json_data: Any | None = None) -> requests.Response Send a POST request to the given endpoint. :param endpoint: API endpoint (relative or absolute) :param params: Optional arguments to be sent :param data: Optional data to be sent :param json_data: Optional JSON data to be sent :returns: :class:`requests.Response ` object .. py:property:: info :type: dict[str, str] EPICS Archiver Appliance information. .. py:property:: identity :type: str | None EPICS Archiver Appliance identity. .. py:property:: version :type: str | None EPICS Archiver Appliance version. .. py:method:: _get_or_post(endpoint: str, pv: str) -> Any Send a GET or POST if pv is a comma separated list. :param endpoint: API endpoint :type endpoint: str :param pv: name of the pv. Can be a GLOB wildcards or a list of comma separated names. :type pv: str :returns: list of submitted PVs :rtype: Any