Control OctoPrint by Python

What is the problem?

I'm looking for a method to control OctoPrint completely by python code only. I am trying to automate printing completely.

What did you already try to solve it?

I've found Octocontrol which controls OctoPrint by command prompt but nothing else.

You can use the rest API from Python, to do this. Or, write a plugin that does this for you (since the server is written in python).