- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2022
02:49 PM
Update in case anyone in the future comes across this:
Once the report is finished running (status = complete) there is a JSON value called "attachments" that you can get as a dictionary. Inside of the dictionary there is a value called "url" which returns a url to the file that you can download with a GET request. The relevant part of the code I used is below:
#The following chunk is ran in a recursive function - run status, check to see if statusID = complete - if so, continue, if not, sleep and then call the function again
#url = the HTTP url that I used to run the report
statusURL = url + "/" + str(id)
getStatus = requests.get(statusURL, headers = headers)
response = getStatus.json()
statusString = json.dumps(response)
parser = json.loads(statusString)
statusID = parser["status"]
#Once we get to here we know the report is completed - fileURL is the one you can call a GET request with
attachment = parser["attachment"]
fileURL = attachment["url"]