Python Client Implementation


#1

Hello,

I see there is a library for JS documented here, I was wondering if there is any sort of class based implementation of the Octoprint API in Python.
The octoprint_client implementation just has the methods for interacting with the API itself, no validation or ease of use is implemented.

What I mean is a library where I can call something like:

client.printer.tools['tool0']

And it gives me a TemperatureData object with actual, target and offset.

I implemented my own based on the documentation, but I don't want to deviate too much from the community effort.
Am I missing something?


#2

Nope, you are not missing something, the octoprint_client one is about it when it comes to official python clients. There are a bunch of hits when googling "octoprint api client python", however I don't know about the status of any of those.

The JS client lib is as fleshed out as it is since I constantly use it for the web interface as well. So it's pretty much a byproduct of regular development, which is a plus for anyone wanting to implement an alternative UI as well through a UiPlugin.

I'd be happy to welcome PRs for a less barebones API client lib built on top of the low level functions in octoprint_client however :wink:


#3

Cool, I hate doing duplicate work.
It is still in draft mode and I'm improving it as I go, so it is also a byproduct of regular development :smiley:
It is based almost solely on the documentation, so I ran into some outdated documentation, but I can't remember where. I'll start actually doing more PRs for doc changes as soon as I find something instead of working around it.
A lot of error checking is still missing and stuff like that.
I'll have to integrate it into the octoprint_client, but it should be fairly simple, since I'm just using simplified requests methods for talking to the endpoints.
I'll see what I can do. Expect some news :wink:


#4

Hola Miguel and Foosel of course :slight_smile: Any updates on the client? I saw some mostly abandoned github projects, and just wanted to check if there are any progress and avoid redundant work.

I'm building a simple "plugin" myself that would display Gcode commands on the client outputted onto headless (or graphicless) terminal. Not very much usage, but just to have something scrolling on the monitor hooked up to my octoprint server next to the printer.


#5

Coming from the CNC world—if you're babysitting the job—you've got one eye on the board and one on the console and the GCODE is streaming by with the current line highlighted. I really miss that much control.