labthings_fastapi.client ======================== .. py:module:: labthings_fastapi.client .. autoapi-nested-parse:: Code to access `.Thing` features over HTTP. This module defines a base class for controlling LabThings-FastAPI over HTTP. It is based on `httpx`, and attempts to create a simple wrapper such that each Action becomes a method and each Property becomes an attribute. Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/labthings_fastapi/client/in_server/index Functions --------- .. autoapisummary:: labthings_fastapi.client.poll_invocation Package Contents ---------------- .. py:function:: poll_invocation(client: httpx.Client, invocation: dict, interval: float = 0.5, first_interval: float = 0.05) -> dict Poll a invocation until it finishes, and return the output. When actions are invoked in a LabThings-FastAPI server, the initial POST request returns immediately. The returned invocation includes a link that may be polled to find out when the action has completed, whether it was successful, and retrieve its output. :param client: the `httpx.Client` to use for HTTP requests. :param invocation: the dictionary returned from the initial POST request. :param interval: sets how frequently we poll, in seconds. :param first_interval: sets how long we wait before the first polling request. Often, it makes sense for this to be a short interval, in case the action fails (or returns) immediately. :return: the completed invocation as a dictionary.