Listen, if you're reading these messages for information, I'm not the coder for you
This commit is contained in:
parent
d4a98a917e
commit
ecc510b2bb
@ -3,8 +3,9 @@ from dotenv import load_dotenv
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
pageSize = 10 # Just so I don't have to keep changing stuff
|
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):
|
def apiGetRequest(api_base, endpoint, params, headers):
|
||||||
url = api_base + endpoint
|
url = api_base + endpoint
|
||||||
@ -20,7 +21,7 @@ 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': 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
|
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
|
for thing in additions: # Yo dawg I heard you like loops
|
||||||
print(' ' + thing['product']['identifier'] + ' - $' + str(thing['unitPrice']))
|
print(' ' + thing['product']['identifier'] + ' - $' + str(thing['unitPrice']))
|
||||||
|
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
####################### !!! DO NOT DISAPPOINT THE FROG WIZARD !!! #########################
|
####################### !!! DO NOT DISAPPOINT THE FROG WIZARD !!! #########################
|
||||||
# .-----.
|
# .-----.
|
||||||
# /7 . (
|
# /7 . (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user