The Odoo server also provides an external API, which is used by its web client and is also available for other client applications.

In this chapter, we will learn how to use the Odoo external API from our own client programs. Any programming language can be used, as long as it has support for XML-RPC or JSON-RPC protocols. As an example, the official documentation provides code samples for four popular programming languages: Python, PHP, Ruby, and Java.

To avoid introducing additional languages the reader might not be familiar with, here we will focus on Python-based clients, although the techniques to handle the RPC calls also apply to other programming languages.

We will describe how to use the Odoo RPC calls, and then use that to build a simple To‑Do desktop app using Python.

Finally, we will introduce the ERPPeek client. It is a Odoo client library, that can be used as a convenient abstraction layer for the Odoo RPC calls, and is also a command-line client for Odoo, allowing to remotely manage Odoo instances.

The Odoo API can be accessed externally using two different protocols: XML-RPC and JSON-RPC. Any external program capable of implementing a client for one of these protocols will be able to interact with an Odoo server. To avoid introducing additional programming languages, we will keep using Python to explore the external API.

Until now, we have been running Python code only on the server. This time, we will use Python on the client side, so it's possible you might need to do some additional set up on your workstation.

To follow the examples in this chapter, you will need to be able to run Python files on your work computer. The Odoo server requires Python 2, but our RPC client can be in any language, so Python 3 will be just fine. However, since some readers may be running the server on the same machine they are working on (hello Ubuntu users!), it will be simpler for everyone to follow if we stick to Python 2.

If you are using Ubuntu or a Mac, Python is probably already installed. Open a terminal console, type python, and you should be greeted with something like the following:

Python 2.7.12 (default, Jul  1 2016, 15:12:24)

[GCC 5.4.0 20160609] on linux2

Type "help", "copyright",", "credits" or "license" for more information.
>>>

If you are a Windows user and have Odoo installed in your machine, you might be wondering why you don’t already have a Python interpreter, and additional installation is needed. The short answer is that the Odoo installation has an embedded Python interpreter that is not easily used outside.