From 2cfafc0c2ebdba01e49b1ab1240e69c918fd2118 Mon Sep 17 00:00:00 2001 From: Brad Ganley Date: Sat, 27 Jul 2024 01:47:06 -0500 Subject: [PATCH] added loop for additions, made example env --- env.example | 3 +++ reportguy.py | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 env.example diff --git a/env.example b/env.example new file mode 100644 index 0000000..7612281 --- /dev/null +++ b/env.example @@ -0,0 +1,3 @@ +AUTH_TOKEN= +CLIENT_ID= +API_BASE=https://portal.gotocompu.com/v4_6_release/apis/3.0 \ No newline at end of file diff --git a/reportguy.py b/reportguy.py index ca4a5e7..01dcf8c 100644 --- a/reportguy.py +++ b/reportguy.py @@ -21,7 +21,8 @@ params = {'pageSize': 50, 'conditions': 'agreementStatus!="CANCEL"', 'fields': ' data = apiGetRequest(api_base, endpoint, params, headers) #Put it all together and whadya get for item in data: #This is just iterating through whatever comes back and barfing the data in a readable way - print(f"{item['companyName']} - {item['name']} \n - {item['agreementStatus']}") - -# to do: Make a second function to call agreement additions from returned items. Should be so easy that it's actually kind of stupid that I'm writing this instead of that right now - + print(f"{item['companyName']} - {item['name']} - {item['agreementStatus']}") + additionsEndpoint = '/finance/agreements/' + str(item['id']) + '/additions' + additions = apiGetRequest(api_base, additionsEndpoint, {'pagesize': 50}, headers) + for thing in additions: + print(' ' + thing['product']['identifier'])