27 lines
624 B
Python
Executable File
27 lines
624 B
Python
Executable File
from pyconnectwise import ConnectWiseManageAPIClient
|
|
import os
|
|
from dotenv import load_dotenv
|
|
load_dotenv()
|
|
comp_id = os.getenv('comp_id')
|
|
client_id = os.getenv('client_id')
|
|
api_pub = os.getenv('api_pub')
|
|
api_priv = os.getenv('api_priv')
|
|
url_base = "portal.gotocompu.com"
|
|
print(comp_id,api_pub)
|
|
# init client
|
|
api_client = ConnectWiseManageAPIClient(
|
|
comp_id,
|
|
url_base,
|
|
client_id,
|
|
api_pub,
|
|
api_priv,
|
|
)
|
|
thing = api_client.company.companies.get()
|
|
print(thing)
|
|
with open('output.json', 'w') as f:
|
|
for entry in thing:
|
|
print(f"{entry.identifier}\n\n\n\n\n")
|
|
f.write(f"{entry}\n\n\n")
|
|
|
|
|