The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December. Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
I'm writing a Python script that runs a series of reports daily. So far, the script successfully runs the report, waits for it to finish, then stores the link to the file in a variable called fileURL. When I run the following request:
{"status":"unauthenticated","errors":[{"message":"user authorization required"}]}
I've included the access token as a parameter of the request header, so how can I authenticate this request?
Solved! Go to Solution.
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
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
I am having the same issue as you posted originally, but I am having trouble implementing the solution. I don't understand how this solves the authentication token problem. I think the part of the code I don't understand is this:
statusURL = url + "/" + str(id)
What is the str(id), and do I need to define the `id` parameter? When I run as-is, I get the following error:
----> 9 response = getStatus.json()
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in