Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I connect to quickbooks online via python?

I'm trying to figure out how to authenticate and create an entry on quickbooks online through Python. Currently, when I try to click auth link in their API Explorer, I get 404 page.

What I'm trying to do is creating invoice through Python. However, it seems like their documentation is not complete. I contacted their support, and I haven't heard from them yet.

like image 694
Ahmed Avatar asked Nov 02 '25 15:11

Ahmed


1 Answers

The python-quickbooks library is probably the correct choice now, as it is a "complete rework of quickbooks-python". It has pretty comprehensive instructions on getting and using the auth keys, though I wouldn't call it "simple", since the process is by definition somewhat complex. The instructions are "for Django", but the Django-specific code simply gets parameters out of a URL string.

We're using it to great effect, because the syntax is as easy as:

auth_client = AuthClient(
    client_id = CLIENT_ID # from QB website
    ,client_secret = CLIENT_SECRET # from QB website
    ,environment = 'sandbox' # or 'production'
    ,redirect_uri = REDIRECT_URI
)

client = QuickBooks(
    auth_client = auth_client
    ,refresh_token = REFRESH_TOKEN
    ,company_id = COMPANY_ID
)

account = Account.get(qbid, qb=client) # qbid can be retrieved from the AccountList
return account.CurrentBalance
like image 97
TheGerm Avatar answered Nov 04 '25 06:11

TheGerm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!