Skip to content

Nicer way to create ThingClients and interact with server. #265

@julianstirling

Description

@julianstirling

We can use ThingClient.from_url but f we have lots of things on the same server then we want to use the same httpx.Client, but actually knowing what is on the server we can looks the Thing Descriptions. It may be nice to have some form of LabThingsClient or ServerConnection or something with a better name so I create a connection and ask that connection for the ThingClients in cleaner code:

>>> microscope = lt.remote_connection("http://microscope.local:5000")
>>> microscope.available_things
["camera", "stage", "syestem"]
>>> stage_client = microscope.get_thing_client("camera")
>>> stage_client.position
{"x": 0, "y": 0, "z": 0}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions