god damn I'm dumb
This commit is contained in:
parent
c76a92fe82
commit
4f792e54ce
@ -11,14 +11,14 @@ def apiGetRequest(api_base, endpoint, params, headers):
|
|||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
return resp.json()
|
return resp.json()
|
||||||
|
|
||||||
apiBase = os.environ["API_BASE"]
|
api_base = os.environ["API_BASE"]
|
||||||
authToken = os.environ["AUTH_TOKEN"]
|
authToken = os.environ["AUTH_TOKEN"]
|
||||||
clientId = os.environ["CLIENT_ID"]
|
clientId = os.environ["CLIENT_ID"]
|
||||||
endpoint = '/finance/agreementrecap' #endpoint for GET
|
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
|
headers = {'Authorization': authToken, 'clientId': clientId} # DO NOT fill this out and then commit it to the publicly-viewable git repository, please
|
||||||
params = {'pageSize': 50, 'conditions': 'agreementStatus!="CANCEL"', 'fields': 'id,companyName,name,lastInvoiceAmount,nextInvoiceAmount,agreementStatus'} # API call params--prepare to cry if your url encoding is sub-par
|
params = {'pageSize': 50, 'conditions': 'agreementStatus!="CANCEL"', 'fields': 'id,companyName,name,lastInvoiceAmount,nextInvoiceAmount,agreementStatus'} # API call params--prepare to cry if your url encoding is sub-par
|
||||||
|
|
||||||
data = apiGetRequest(apiBase, endpoint, params, headers) #Put it all together and whadya get
|
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
|
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']}")
|
print(f"{item['companyName']} - {item['name']} \n - {item['agreementStatus']}")
|
||||||
|
Loading…
Reference in New Issue
Block a user