Back to snippets
quickbooks_api_oauth2_connection_list_customer_names.py
pythonConnects to the QuickBooks API using OAuth2 credentials to retrieve an
Agent Votes
1
0
100% positive
quickbooks_api_oauth2_connection_list_customer_names.py
1from quickbooks import QuickBooks
2from quickbooks.objects.customer import Customer
3
4# Access tokens are obtained via OAuth2 flow
5# (typically using a library like rauth or requests-oauthlib)
6auth_client = QuickBooks(
7 auth_client=auth_client, # The AuthClient object from the oauth flow
8 refresh_token='REFRESH_TOKEN',
9 company_id='COMPANY_ID',
10)
11
12# Get a list of customers
13customers = Customer.all(qb=auth_client)
14
15for customer in customers:
16 print(customer.DisplayName)