PyExo is a Python API for accessing the REST API provided by the MYOB EXO accounting tool. It allows access to local, remote and cloud applications.
Include the library folder with your application and import it.
All requests made to the MYOB EXO API require authentication headers that contain your EXO username, password, a developer key and an EXO token generated using the EXO Config application in your installation. You can find details for how to get these from the MYOB EXO Developer pages:MYOB EXO API page.
For convenience you can setup the following environment variables: EXO_USERNAME, EXO_PASSWORD, EXO_API_KEY, MYOB_EXO_TOKEN. For example, in Linux you could add these variables into ~./bashrc and for MacOS into ~/.bash_profile as shown below. You can also specify the environment variables in Windows. Note that you will need to reload the terminal for these to come into effect e.g using
$ . ~/.bashrc
or by restarting the terminal.
$ export MYOB_EXO_USERNAME=demo
$ export MYOB_EXO_PASSWORD=DEMO
$ export EXO_API_KEY=ABCta353c5R6YXRvcjo=
$ export EXO_TOKEN=123AA353c5R6YXRsTAQ18*%
You can also set the environment variables from a configuration file as below:
Create a '.env' file in the root directory of your application and configure it as shown below:
[DEFAULT]
EXO_IP = <exo server ip>
EXO_PORT = <api port>
[AUTH]
EXO_USERNAME = <your exo username>
EXO_PASSWORD = <you exo password>
EXO_API_KEY = <key>
EXO_TOKEN = <token>
e.g.
[DEFAULT]
EXO_IP = 192.168.0.1
EXO_PORT = 8888
[AUTH]
EXO_USERNAME = demo
EXO_PASSWORD = DEMO
EXO_API_KEY = ABCta353c5R6YXRvcjo=
EXO_TOKEN = 11111111111122222222222222222333333333...
Setting the authentication headers is done when initialising an instance of the API. First import the modules:
$ from exo import Exo
$ from exo.auth import Credentials
If you have the environment variables setup then:
$ credentials = Credentials()
Otherwise you can enter them manually:
$ credentials = Credentials(<username>, <passoword>, <key>, <token>)
Then pass them into an instance of the Exo class:
$ exo = Exo(credentials)
The API is a work in progress, it returns dictionaries exactly as provided by the EXO API.
Add tests and examples
This project requires the requests module for the API calls