Skip to content

Unoffcial python binding for authodarts web api and websocket

License

Notifications You must be signed in to change notification settings

belese/python-autodarts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoDarts Python Library

Overview

The AutoDarts Python library is an unofficial implementation for interacting with the AutoDarts web API and WebSocket. This library is designed to provide a convenient way to integrate AutoDarts functionality into Python applications. It supports asynchronous operations to handle real-time updates via WebSocket.

THIS IS A WIP PROJECT, IN BETA VERSION

Features

Session

  • AutoDartSession: Handles authentication and provides a session for making API requests and web socket connection.

Websocket and endpoint

  • CloudBoard: Represents your Cloud dartboard support.
  • Match: Represents a match in AutoDarts.
  • Lobby: Represents a lobby in AutoDarts.

Endpoint

  • User: Represents a user in AutoDarts.

Child

  • Player: Represents a player in AutoDarts.

Installation

python3 -m build
pip install dist/autodarts-0.0.1-py3-none-any.whl

Usage

# Initialize AutoDartSession
from autodarts import AutoDartSession, CloudBoard

#create the session
session = AutoDartSession(
    email=email,
    password=password,
    client_id=client_id,
    realm_name=realm_name,
    client_secret_key=client_secret_key,
)

#get the cloud board from its id
cloud_board = await CloudBoard.from_id( session, BOARD_ID )

# Connect to events 
cloud_board.connect() 

#get attribute
print(f"Board Name: {cloud_board.name}")

#call action
await cloud_board.async_start()

#access relationchip
match = await cloud_board.async_get_match()

#register callback
async def on_board_connected(msg):
    print("Board connected : ", msg)
    await asyncio.sleep(1)
       
unregister_handler = cloud_board.register_callback(on_board_connected, "Connected")

#unregister
unregister_handler()

# disConnect from events 
cloud_board.disconnect()

See example folder for a more detailled example

MAny thanks to TmO for autodarts software, and Wusssa for it's caller and let me borrow some code

About

Unoffcial python binding for authodarts web api and websocket

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages