From ecc510b2bb8dfc8591a4a2b13268e6537929baf0 Mon Sep 17 00:00:00 2001 From: Brad Ganley Date: Sat, 27 Jul 2024 15:38:06 -0500 Subject: [PATCH] Listen, if you're reading these messages for information, I'm not the coder for you --- reportguy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/reportguy.py b/reportguy.py index a0977d6..e13ddd4 100644 --- a/reportguy.py +++ b/reportguy.py @@ -3,8 +3,9 @@ from dotenv import load_dotenv import os pageSize = 10 # Just so I don't have to keep changing stuff +paramFields = 'id,companyName,name,lastInvoiceAmount,nextInvoiceAmount,agreementStatus' # if we neeeed to make multiple similar calls we may as well save some typing -load_dotenv() +load_dotenv() # make sure to include this avoid troubleshooting why your auth doesn't work for 40 minutes def apiGetRequest(api_base, endpoint, params, headers): url = api_base + endpoint @@ -20,7 +21,7 @@ authToken = os.environ["AUTH_TOKEN"] clientId = os.environ["CLIENT_ID"] endpoint = '/finance/agreementrecap' #endpoint for GET headers = {'Authorization': authToken, 'clientId': clientId} # DO NOT fill this out and then commit it to the publicly-viewable git repository, please -params = {'pageSize': pageSize, 'conditions': 'agreementStatus="ACTIVE"', 'fields': 'id,companyName,name,lastInvoiceAmount,nextInvoiceAmount,agreementStatus'} # API call params--prepare to cry if your url encoding is sub-par +params = {'pageSize': pageSize, 'conditions': 'agreementStatus="ACTIVE"', 'fields': paramFields} # API call params--prepare to cry if your url encoding is sub-par data = apiGetRequest(api_base, endpoint, params, headers) #Put it all together and whadya get @@ -31,6 +32,8 @@ for item in data: #This is just iterating through whatever comes back and barfin for thing in additions: # Yo dawg I heard you like loops print(' ' + thing['product']['identifier'] + ' - $' + str(thing['unitPrice'])) + + ################################################################################### ####################### !!! DO NOT DISAPPOINT THE FROG WIZARD !!! ######################### # .-----. # /7 . (