Python script to connect to Brightspace API

Roopa.K.6462
Roopa.K.6462 Publicaciones: 4 🌱
editado septiembre 11 en Social Groups
Hello Everyone,

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.

Comentarios

  • Randall.S.394
    Randall.S.394 Publicaciones: 17 🌱

    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:

    https://requests.readthedocs.io/en/latest/

  • Roopa.K.6462
    Roopa.K.6462 Publicaciones: 4 🌱

    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.

  • Roopa.K.6462
    Roopa.K.6462 Publicaciones: 4 🌱

    @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.


    Thank you again for your time and help.
    Roopa

    https://community.d2l.com/brightspace/kb/articles/1105-brightspace-data-sets-headless-non-interactive-client-example