Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

hidio Client Python Library

HID-IO Client Side Library for Python

Linux Status macOS Status Windows Status

Visit our IRC channel

Getting

pip install hidio

Overview

This is a convenience Python library for the HID-IO daemon which handles automatic reconnection if the server goes down for any reason. The library also handles the HID-IO authentication procedure (key negotiation and TLS wrapping).

Usage

import asyncio
import sys

import hidio.client

# Optional callbacks
class MyHIDIOClient(hidio.client.HIDIOClient):
    async def on_connect(self, cap):
        print("Connected!")
        print("Connected API Call", await cap.alive().a_wait())


    async def on_disconnect(self):
        print("Disconnected!")


async def main():
    client = MyHIDIOClient('Python example.py')
    # Connect the client to the server using a background task
    # This will automatically reconnect
    tasks = [asyncio.gather(*[client.connect(auth=hidio.client.HIDIOClient.AUTH_BASIC)], return_exceptions=True)]
    while client.retry_connection_status():
        if client.capability_hidioserver():
            try:
                print("API Call", await asyncio.wait_for(
                    client.capability_hidioserver().alive().a_wait(),
                    timeout=2.0
                ))
                print("API Call", await asyncio.wait_for(
                    client.capability_authenticated().nodes().a_wait(),
                    timeout=2.0
                ))
            except asyncio.TimeoutError:
                print("Alive timeout.")
                continue
        await asyncio.sleep(5)


try:
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
except KeyboardInterrupt:
    print("Ctrl+C detected, exiting...")
    sys.exit(1)

Metadata

Release files for hidio 0.1.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hidio 0.1.0b1
File Size Uploaded
hidio-0.1.0b1.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hidio 0.1.0b1
File Interpreter ABI Platform
hidio-0.1.0b1-py3-none-any.whl Python 3 none any Details

Total release size: 39.4 kB

Release files / hidio-0.1.0b1.tar.gz

Download URL hidio-0.1.0b1.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
68a835685cf6391172d4a00efd7ec49ed169656500a0dafe3ee5ab236e6ed8f2
BLAKE2b-256 checksum
How to use checksums
10b0ab433b1682520546cf88416350c2b57d7e101032ec981db54ddd0f357f52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.22.0

Release files / hidio-0.1.0b1-py3-none-any.whl

Download URL hidio-0.1.0b1-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21e2a0874aa6b807d0ecf2795dfb130df7881abdb1d91aef0e09f75a14b61e6d
BLAKE2b-256 checksum
How to use checksums
8446f9c0ba89d3819fa0d09ef86276154dfb9f5c2f180acbb6373dd7acc0a6ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.22.0

Release history Release notifications | RSS feed

This release

0.1.0b1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page