From 64df1f12a47ffdb2727376ff4e905cd40ee22292 Mon Sep 17 00:00:00 2001 From: Brad Ganley Date: Sat, 27 Jul 2024 09:17:14 -0500 Subject: [PATCH] honestly not sure what I changed sorry --- reportguy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reportguy.py b/reportguy.py index 01dcf8c..7e06d10 100644 --- a/reportguy.py +++ b/reportguy.py @@ -10,6 +10,8 @@ def apiGetRequest(api_base, endpoint, params, headers): if resp.status_code == 200: return resp.json() + else: + resp.raise_for_status() api_base = os.environ["API_BASE"] authToken = os.environ["AUTH_TOKEN"] @@ -23,6 +25,6 @@ data = apiGetRequest(api_base, endpoint, params, headers) #Put it all together a 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']} - {item['agreementStatus']}") additionsEndpoint = '/finance/agreements/' + str(item['id']) + '/additions' - additions = apiGetRequest(api_base, additionsEndpoint, {'pagesize': 50}, headers) - for thing in additions: + additions = apiGetRequest(api_base, additionsEndpoint, {'pagesize': 50}, headers) + for thing in additions: # Yo dawg I heard you like loops print(' ' + thing['product']['identifier'])