Package resonitepy

resonitepy

Unofficial Resonite API python library (HTTP + SignalR hub). Sync and async.

Based on a work by neosvrpy.

The code is still in WIP mode, see the files resonitepy/classes.py and resonitepy/client.py for how to use them. The SignalR protocol is yet to be fully implemented.

Install

poetry install

Basuc Usage (sync)

from resonitepy.client import Client
from resonitepy.classes import LoginDetails, LoginDetailsAuth

client = Client()
client.login(LoginDetails(
    ownerId="U-yourUserId",
    authentication=LoginDetailsAuth(password="your password"),
))

for contact in client.getContacts():
    print(contact.contactUsername, contact.contactStatus)

Async with live events (via SignalR hub)

import asyncio
from resonitepy.client import Client
from resonitepy.classes import LoginDetails, LoginDetailsAuth
from resonitepy.hub_manager import HubManager, EventTarget

async def main():
    client = Client()
    client.login(LoginDetails(
        ownerId="U-yourUserId",
        authentication=LoginDetailsAuth(password="your password"),
    ))
    hub = HubManager(client)
    await hub.connect()

    def on_message(args):
        print(args[0])

    hub.on(EventTarget.receivedMessage, on_message)
    await asyncio.sleep(3600)
    await hub.disconnect()

asyncio.run(main())
Expand source code
"""
.. include:: ../README.md
"""
import sys

if sys.version_info[:2] >= (3, 8):
    from importlib import metadata
else:
    import importlib_metadata as metadata

__version__ = metadata.version(__package__)

del metadata, sys

Sub-modules

resonitepy.classes

This module define some of the Resonite API json responce under usable python classes.

resonitepy.client

This module defines the Resonite client, which interacts with the Resonite API.

resonitepy.endpoints

This module define some basic domain use by Resonite API.

resonitepy.exceptions

This module define the Exceptions classes use by this package.

resonitepy.hub_manager
resonitepy.secrets
resonitepy.signalr
resonitepy.utils

This module define some generic function use at multiple places in the package.