Can I use octoprint server as library in my python tool



I want to develop a small controller for my Octoprint

put the only way to communicate with Octoprint in my code using any available API without using the Authentication key

is this is possible

if not
is there any tool to handle the communication with the 3D printer like the one in the Cure software that will allow me to print and set the temperature


The REST API is the best method of controlling the printer and your code should be able to set the API key in the GET/POST headers, as sent.


Is there any way to not use the key

I do not want to use the key


Even the official command-line client uses the API key:


The key is there for your safety and for the safety of the people who end up using your tool (if you open-source it).

For example, see my own octo-client library for NodeJS and how that is configured, as in...


Next, you'll need to edit your appdir's node_modules/octo-client/config.js file to enter your printer's hostName ("octopi.local" by default) and apiKey (found under OctoPrint -> Settings -> API).


Thank for your responses

So there is no way to use the API without hardcode the API key
So I need to change each code for each client and edit the API key
Is there any way to get the API key dynamically


Like almost anything that interfaces with OctoPrint, you need to present your user with an opportunity to identify 1) the hostname or IP address and 2) the API key.

Here's another example of a smartphone app which I wrote for controlling a printer via the REST interface. Note the "Add a Printer" feature in the Settings area as well as the "Add Printer Wizard" screen.

If you can write a QR code reader and this is a mobile app, you could have the user visit their OctoPrint's -> Settings -> API page and scan the QR code that's there (so that they don't have to type it in).


If your tool runs on the same computer, couldn’t it just get the key from the config.yaml file?

If your tool runs from another computer, you could look in to AppKeys, which are new in 1.3.10


I wouldn't like an app to "go behind my back" and read the API key. I expect to permission apps one at a time since I consider it my data.