dragondgold/octo-control

Using as Python Code

kgdthomas opened this issue · 1 comments

I firstly want to thank you for the time you've committed to building octocontrol. It's a really amazing tool and it was a great discovery for me.

I am not a great coder; there are things I'm not 100% sure about.

I am trying to use Python code to send GCODE to my printer and I was wondering if octocontrol can be used in that way, without command prompt, just through python only.

Hi @kgdthomas ! I'm glad to hear my code is useful for you!

Yes, you can absolutely use octocontrol from your code without using a command prompt, just import the OctoprintAPI class with from octocontrol import OctoprintAPI then you can instantiate and use it to do everything you can do from the command line. Example:

from octocontrol import OctoprintAPI
octo_api = OctoprintAPI(host, port, apikey)
print(octo_api.get_extruder_target_temp())

Hope that helps!