I'm new to using the Valence API and working through the code samples in Python. I've been stumped by a 500 error when running the code from the "Fetch final grades" sample (found at http://docs.valence.desire2learn.com/samples/finalGrades.html). I'm new to programming in general and fear that I don't know what further information to provide to diagnose my issue. The error notes "Exception: HTTPError('404 Client Error: Not Found',)"

I can also provide traceback notes, which I'm hoping is appropriate to post here.

Traceback (most recent call last):

...bottle.py", line 764, in _handle return route.call(**args)

...bottle.py", line 1625, in wrapper rv = callback(*a, **ka)

...bottle.py", line 1575, in wrapper rv = callback(*a, **ka)

...finalgrades.py", line 149, in start_handler verify=_CFG['verify'])

...d2lvalence_util\service.py", line 267, in get_whoami return d2ldata.WhoAmIUser(_get(route,uc,**kwargs))

...service.py", line 86, in _get return _fetch_content(r,debug=d)

...service.py", line 46, in _fetch_content r.raise_for_status()

...models.py", line 773, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found

I haven't augmented the code provided by D2L. Did anyone else run into this problem, and if so, how did you solve it?

有帮助吗?

解决方案

The conf.py file should get values put into it that will match the back end service you're working with. The host it's set to work with by default is lms.valence.desire2learn.com, but the version values are set to API versions that are for a more recent version of the LMS software than the one currently running at that default host. This is a defect that wasn't noticed in the testing, because that was done against a more recent LMS version in the test lab. So, when you ran the sample, it plugged in 1.2 as the version value in the API route and you got back a 404 because the resulting route doesn't exist on the LMS your sample app contacted.

I'll update the samples to correct this, but when you use the samples you should change the conf.py values to things appropriate for your own LMS you're using, and ideally an App ID and Key that you've personally applied for and received from D2L's KeyTool Service. You can use the basic sample against that default LMS with the test user, but the other two samples may not work well as the test user account might not have sufficient privileges to make the appropriate API calls contained in the samples... They're more designed with you to play with against your organization's own LMS.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top