bda_hubapi
bda_hubapi
bda_hubapi
#Sends request to project endpoint. Parameters are optional and mapped directly
# from API documentation.
def getProjects( self, limit=100, offset=0,sort='',q=''):
payload = {'limit':limit, 'offset':offset, 'sort':sort, 'q':q}
response = self.aSession.get(self.urlCompose('api/projects'),
params=payload)
if response.ok:
return response.json()
else:
print('Bad response in getProjects')
return response.json()
#Sends post request to have Hub create a report about a version of a project.
# reportURL comes from the body of the getVersion response.
def generateReport( self, reportURL):
reportFormat = {'reportFormat':'CSV'}
response = self.aSession.post(reportURL, json = reportFormat, headers={'x-
csrf-token':self.CSRF})
if response.ok:
return response.text
else:
print("Error: bad request in generateReport()")
return response.text