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
- AutoDartSession: Handles authentication and provides a session for making API requests and web socket connection.
- CloudBoard: Represents your Cloud dartboard support.
- Match: Represents a match in AutoDarts.
- Lobby: Represents a lobby in AutoDarts.
- User: Represents a user in AutoDarts.
- Player: Represents a player in AutoDarts.
python3 -m build
pip install dist/autodarts-0.0.1-py3-none-any.whl
# 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