Python script to connect to Brightspace API
I just joined this community. I am asking this question for a colleague (supervisor) who is trying to connect to the Brightspace API using python. We tried the postman (I am new to all of this so pardon my ignorance) which works fine, but when we try to get a response using python script, we get an error.
Has anyone tried using python to connect to the API? Could you please share some insight on this?
Thank you,
Roopa
SUNY Empire State University.
Comments
-
I use it to download datasets from the datahub into a database. I started from the examples from here:
https://community.brightspace.com/s/article/Brightspace-Data-Sets-Headless-Non-Interactive-Client-Example
Take a close look at the trade_in_refresh_token and get_with_auth functions.
It uses the Requests library from here:
-
Thank you so much for sharing this information, Randall. The latest I heard from my colleague is this:
I used postman to get the token and then used the token in my python and I still get the forbidden message. I have another script that opens a browser programmatically and works but requires user interaction.
My supervisor thinks if it's actually an issue with the API configuration itself. I will post an update as soon as I hear more from him.
Thank you again.
-
@Randall.S.394 Thank you for sharing the KB article. I couldn't open the link you shared, but I searched on the website and found this link below; I am hoping it's the same one that you referred to. We were wondering if you could share your working scrip t ? (with no credential information listed). Only if you are able; if not, it's totally ok.
Sorry one more question from my colleague (supervisor):
I am curious where Randall got the refresh token that's in the config.json file.
We really appreciate all your help. I am also going to try and reach out to D2L tech support and see if I can get some assistance.
Thank you again for your time and help.
Roopa