A Python library for accessing the Quickbooks API.
Project description
A Python library for accessing the Quickbooks API. Complete rework of quickbooks-python.
These instructions were written for a Django application. Make sure to change it to whatever framework/method you’re using.
Connecting your application to Quickbooks Online
Create the Authorization URL for your application:
from quickbooks import QuickBooks quickbooks = QuickBooks( sandbox=True, consumer_key=QUICKBOOKS_CLIENT_KEY, consumer_secret=QUICKBOOKS_CLIENT_SECRET, callback_url=CALLBACK_URL ) authorize_url = quickbooks.get_authorize_url()
Store the authorize_url, request_token, and request_token_secret for use in the Callback method.
Handle the callback:
quickbooks = QuickBooks( sandbox=True, consumer_key=QUICKBOOKS_CLIENT_KEY, consumer_secret=QUICKBOOKS_CLIENT_SECRET, callback_url=CALLBACK_URL ) quickbooks.authorize_url = authorize_url quickbooks.request_token = request_token quickbooks.request_token_secret = request_token_secret quickbooks.set_up_service() quickbooks.get_access_tokens(request.GET['oauth_verifier']) realm_id = request.GET['realmId'] access_token = quickbooks.access_token access_token_secret = quickbooks.access_token_secret
Store realm_id, access_token, and access_token_secret need to be stored for later use.
Accessing the API
QuickBooks client uses a singleton pattern. Just be sure to create the QuickBooks object before you make any calls to QBO. Setup the client connection using the stored access_token and the access_token_secret and realm_id:
from quickbooks import QuickBooks QuickBooks( sandbox=True, consumer_key=QUICKBOOKS_CLIENT_KEY, consumer_secret=QUICKBOOKS_CLIENT_SECRET, access_token=access_token, access_token_secret=access_token_secret, company_id=realm_id )
If you need to access a minor version (See Minor versions for details) pass in minorversion when setting up the client:
QuickBooks( sandbox=True, consumer_key=QUICKBOOKS_CLIENT_KEY, consumer_secret=QUICKBOOKS_CLIENT_SECRET, access_token=access_token, access_token_secret=access_token_secret, company_id=realm_id, minorversion=4 )
List of objects:
from quickbooks.objects.customer import Customer cu
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.