Desire2Learn Valence API | JSON not loading -


i'm using python requests library valence-provided python sdk attempt request. odd happening url , i'm not sure what. response 200 (which leads me believe authentication working), when try print json request object, instead prints html of page instead of json.

i'm using modified code read http://docs.valence.desire2learn.com/clients/python/auth.html.

here's python code:

import requests import auth d2lauth auth import *  app_creds = { 'app_id': '----', 'app_key': '----' }  ac = d2lauth.fashion_app_context(app_id=app_creds['app_id'], app_key=app_creds['app_key'])  auth_url = ac.create_url_for_authentication('ugatest2.view.usg.edu', 'http://localhost:8080')  redirect_url = "https://localhost:8080?x_a=3----&x_b=3dmrgcbahxjdta2e6djifdwq-gyl-pk77ff_3x5oduuqc"  uc = ac.create_user_context(auth_url, 'ugatest2.view.usg.edu', true)  route = 'ugatest2.view.usg.edu/d2l/api/versions/'  url = uc.create_authenticated_url(route)  r = requests.get(url)  print(r.text)  

the output html of page instead of json. if print(r), status of 200. think redirect url may issue, i'm not sure wrong. help!

two things off me:

  • using auth_url create user context isn't going work, that's url need send user can authenticate. need use url redirected after authenticating build user context. assuming redirect_url url, should passing create_user_context , not auth_url.

  • ugatest2.view.usg.edu/d2l/api/versions/ not valid value passing create_authenticated_route, /d2l/api/versions want. sdk prepend scheme, domain, , port including in value passed going result in incorrect uri.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -