epicsarchiver.common.async_service ================================== .. py:module:: epicsarchiver.common.async_service .. autoapi-nested-parse:: Module to cover the ServiceClient for doing http calls. Attributes ---------- .. autoapisummary:: epicsarchiver.common.async_service.LOG Classes ------- .. autoapisummary:: epicsarchiver.common.async_service.ServiceClient Module Contents --------------- .. py:data:: LOG :type: logging.Logger .. py:class:: ServiceClient(base_url: str) An async and sync http service client. For doing basic GET POST http calls. .. py:attribute:: base_url .. py:attribute:: _session :type: aiohttp.ClientSession | None :value: None .. py:property:: session :type: aiohttp.ClientSession Return the aiohttp session. :returns: The session. :rtype: ClientSession .. py:method:: close() -> None :async: Close the Service (closes the session). .. py:method:: __aenter__() -> typing_extensions.Self :async: Asynchronous enter. :returns: self :rtype: Self .. py:method:: __aexit__(exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None) -> None :async: Asynchronous exit, closes any sessions. .. py:method:: _get(endpoint: str, params: collections.abc.Mapping[str, str] | None = None) -> aiohttp.ClientResponse :async: Send a GET request to the given endpoint. :param endpoint: API endpoint (relative or absolute) :param params: parameters to be sent :returns: :class:`ClientResponse` object .. py:method:: _get_json(endpoint: str, params: collections.abc.Mapping[str, str] | None = None) -> Any :async: Send a GET request to the given endpoint and return the json. :param endpoint: API endpoint (relative or absolute) :param params: parameters to be sent :returns: :class:`ClientResponse` object .. py:method:: _post(endpoint: str, params: collections.abc.Mapping[str, str] | None = None, data: Any = None, json: Any = None) -> aiohttp.ClientResponse :async: Send a POST request to the given endpoint. :param endpoint: API endpoint (relative or absolute) :param params: parameters to be sent :param data: Data to send :param json: Alternative to data :returns: :class:`ClientResponse` object