honestly not sure what I changed sorry

This commit is contained in:
Brad Ganley 2024-07-27 09:17:14 -05:00
parent 2cfafc0c2e
commit 64df1f12a4

View File

@ -10,6 +10,8 @@ def apiGetRequest(api_base, endpoint, params, headers):
if resp.status_code == 200: if resp.status_code == 200:
return resp.json() return resp.json()
else:
resp.raise_for_status()
api_base = os.environ["API_BASE"] api_base = os.environ["API_BASE"]
authToken = os.environ["AUTH_TOKEN"] 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 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']}") print(f"{item['companyName']} - {item['name']} - {item['agreementStatus']}")
additionsEndpoint = '/finance/agreements/' + str(item['id']) + '/additions' additionsEndpoint = '/finance/agreements/' + str(item['id']) + '/additions'
additions = apiGetRequest(api_base, additionsEndpoint, {'pagesize': 50}, headers) additions = apiGetRequest(api_base, additionsEndpoint, {'pagesize': 50}, headers)
for thing in additions: for thing in additions: # Yo dawg I heard you like loops
print(' ' + thing['product']['identifier']) print(' ' + thing['product']['identifier'])