Skip to content

Slim client package for connecting to pydase services.

Notifications You must be signed in to change notification settings

tiqi-group/pydase_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pydase_client

This package is a slim client for pydase services, providing you with both synchronous and asynchronous clients.

Installation

You can install this package using pip or poetry:

pip install git+https://github.com/tiqi-group/pydase_client.git
poetry add git+https://github.com/tiqi-group/pydase_client.git

Synchronous

import pydase_client

with pydase_client.Client("ws://localhost:8001") as client:
    client.set_value("some_property", 10.0))
    print(client.get_value("some_property"))
    client.trigger_method("some_function", args=(), kwargs={"input": "Hello"})

You can also leave out the port if it is either 80 (ws) or 443 (wss).

Asynchronous

import asyncio

import pydase_client


async def do_something() -> None:
    # Using secure websockets
    async with pydase_client.AsyncClient("wss://localhost:443") as client:
        await client.set_value("some_float", 10.2)
        print(await client.get_value("some_float"))
        print(
            await client.trigger_method(
                "some_function", args=(), kwargs={"input": "Hello"}
            )
        )


asyncio.run(do_something())

You can also leave out the port if it is either 80 (ws) or 443 (wss).

About

Slim client package for connecting to pydase services.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages