Python Sample App using Django
Table of Contents
In order to successfully run this sample app you need a few things:
- Python 3 and Django framework
- A developer.intuit.com account
- An app on developer.intuit.com and the associated client id and client secret.
First Use Instructions
- Clone the GitHub repo to your computer
- Use the Oauth playground to generate tokens
- Fill in the
config.jsonfile values file values (access_token, refresh_token, realm_id, client_id, client_secret).
Running the code
Once the sample app code is on your computer, you can do the following steps to run the app:
- cd to the project directory
- Run the command:
python manage.py runserver(Mac OS)
- Wait until the terminal output displays the "Starting development server at http://127.0.0.1:8000/" message.
- Your app should be up now in http://localhost:8000/QBOApp
The sample app demonstrates the following:
QBO Create Bill POST API
QBO_requests.py - Shows how to make a QBO API Post request to create a customer.
QBO Bill GET API
QBO_requests.py - Shows how to make a QBO API Get request using the above created Bill Id to read it.
Handle expired tokens
OAuth2_helper.py - Demonstrates how to refresh the token when token expires.
Supporting QBO API requests
QBO_helper.py - Shows how to create supporting entities like Item, Vendor and Account
Storing the tokens
This app stores all the tokens and user information in the session and config file. For production ready app, tokens should be encrypted and stored in a database.