This tutorial will walk you through the steps of connecting your own Python program to ToMaTo by using the ToMaTo library.
We assume you already have started developing your own Python app. This means that there is a root module with multiple sub-modules. The folder structure may be something like this:
Furthermore, it is assumed that you have cloned the git repository to
The library is available at
~/ToMaTo/cli/lib. To add it to your project, you can use a symbolic link:
And in your app:
The main object to access the ToMaTo API is a so-called API proxy. To get an API proxy, you must first create a ToMaTo URL:
Now that you have a URL, you can create the proxy.
That’s it! The
api variable now holds an object that connects to the ToMaTo API.
You can simply call any API method on the API proxy. For example:
I don’t think we have to go further into API usage at this moment. However, there is one thing you should know: The
upload_download module in the library provides easy methods for uploading or downloading images or executable archives, similar to what is available in the CLI. The difference here is that all these methods require you to hand over the API proxy in order to work:
You have now learned how to include the ToMaTo library in your project and use the API proxy to run API calls.
Congratulations! You have finished the API tutorial! For more information, please read the other sections of this manual.