skillfed

moonraker-api

Async websocket API client for Moonraker

moonraker-api v4.0.0 115.5K downloads/30d#12,249 on PyPI22
Copyleft license Active released

What it is and what it does

moonraker-api is a fully asynchronous Python client for Moonraker, a control API commonly used in printer systems. It handles WebSocket connections and subscriptions to real-time state updates without requiring polling loops. The package uses aiohttp and async-timeout as its only runtime dependencies, making it lightweight and suitable for integration into async Python applications.

You instantiate a MoonrakerClient with a listener object implementing MoonrakerListener, then call connect() to establish the WebSocket link. Once connected, you can issue one-off requests or subscribe to push notifications through callback methods. The listener pattern lets your code react to state changes, exceptions, and incoming notifications asynchronously, making it natural to embed in event-driven systems.

Use it for:

  • Monitor real-time printer status and state updates from a system via WebSocket subscriptions.
  • Build integrations or custom dashboards that react to printer state changes without polling.
  • Send commands and query printer configuration through the Moonraker API from an async Python application.
  • Handle authentication errors and connection state transitions in a listener-based event loop.
  • Integrate printer telemetry into monitoring or logging systems that require non-blocking async I/O.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Fully async Python client for connecting to and subscribing to Moonraker's WebSocket API without polling, using aiohttp for network communication.

Yes, if you need to interface with Moonraker from Python. The package is actively maintained, has low install friction, and provides a clean async API. The GPLv3 copyleft license requires any derivative work to remain open-source, so verify that constraint fits your use case. No known vulnerabilities as of 2026-08-14.

Install

moonraker-api on PyPI

pip

pip install moonraker-api

uv

uv add moonraker-api

poetry

poetry add moonraker-api

Installing moonraker-api

Before you install

Low install friction with a pure-Python wheel distribution. Actively maintained with last commit on 2026-08-12; requires Python 3.10 or later.

License in practice

Licensed under GPLv3 (copyleft). Any derivative work or distribution must also be open-source under GPLv3; proprietary use is not permitted.

Quickstart

pip install moonraker-api

from moonraker_api import MoonrakerClient, MoonrakerListener

class MyListener(MoonrakerListener):
    async def on_notification(self, method, data):
        print(f"Notification: {method} -> {data}")

client = MoonrakerClient(MyListener(), HOST, PORT, API_KEY)
await client.connect()
response = await client.request("printer.info")
await client.disconnect()

Requires Python 3.10 or later; aiohttp and async-timeout must be installed as runtime dependencies.

Verify before relying

  • Whether Moonraker server setup and network accessibility are prerequisites for testing this client.
  • Performance characteristics under high-frequency subscription updates or large payloads.
  • Backward compatibility guarantees across minor version updates.

Package facts

License not declared (copyleft)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — aiohttp, async-timeout
Maintenance actively maintained — 65 days since the last release
Last repo commit
First released
Downloads 115,497/month — #12,249 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: moonraker_api-4.0.0-py3-none-any.whl

License :: OSI Approved :: GNU General Public License v3 (GPLv3)Operating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

moonraker websocket clientasync printer apimoonraker api pythonwebsocket subscription clientasync event notificationsmoonraker client library
websocket-clientasync-io

More Internet packages