Skip to main content

D2LValence client library for Python.

Project description

Desire2Learn Client Library for Python

Our Python client library SDK is currently in experimental form. Currently, we
use this libary as a quick way to rapidly, and interactively, prototype or
hand-test back-end LMS services for trouble shooting purposes: it's not intended
for rigorous production use.

**Feedback and contributions welcome**. If you have any feedback or additions
you'd like to make to the Python client library, please feel free to
contact to coordinate with our development team.

.. note::

You can find the latest version of this documentation, and related
topics in our
`Valence API documentation <>`_.

You can find the
`latest build <>`_
of the client library SDK on our repository download page.

**Dependencies**. In order to use the Python client library SDK, you'll need to
first ensure you have a working Python development environment:

* Python 3 (the reference environment uses Python 3.2).

* The `Requests Python package <>`_
gets used in our :py:mod:`service <d2lvalence.service>` module to make the
calls through to the back-end service, and in our :py:mod:`auth <d2lvalence.auth>`
module so that you can use a calling user context object as an authentication
helper for Requests.

* The `Bottle Python package <>`_ if you want to
use the samples available in conjunction with this client library (not a
dependency for the client library itself).

The Python library divides functionality into a number of modules:

**Authentication**. The :py:mod:`d2lvalence.auth` module provides assistance for
the authentication needed to invoke Valence APIs. You use the module's functions
(and perhaps also classes) to create a
:py:class:`calling user context <d2lvalence.auth.D2LUserContext>` object that
you can then employ in conjunction with the Reqeusts package as an
authentication helper.

**Data**. The :py:mod:`` module provides classes to encapsulate
the JSON data structures passed back and forth through the Valence APIs. All the
classes inherit from a :py:class:`D2LStructure generic base class

Note that currently we drive additions to the `data` module by the needs of our
samples and ongoing testing: it does not cover all the structures present in the
Valence API.

**Service**. The :py:mod:`d2lvalence.service` module contains a suite of helper
functions you can use to make Valence API calls and partially digest the data
results passed back. In general, the data passed back by a service function is
either a pre-defined class inheriting from :py:class:`D2LStructure
<>`, or one or more dictionaries formed from the
retrieved JSON data.

.. :changelog:


0.1.10 (2012-12-18)
* revised `data` and `service` modules to update for compatibility with requests
package post version 1.0.0

0.1.9 (2012-10-15)
* added data and service functions for Learning Repostory routes
* added data and service functions for course offering and content routes
* added data and service functions for discussion forum routes
* renamed utility functions in `data` module used for property set/getting to
suggest they should be internal and not directly used
* added default (empty) value for `DescriptorDict` property to the
`data.D2LLockerFile` class
* added `files` named parameter to post and put utility methods for simple file
* fix `service.rename_group_locker_folder()` to propertly form route
* cleanup service module to python-ify parameter names

0.1.8 (2012-08-30)
* added support to the `auth` module for building an anonymous user context
(context with no user ID/Key pair) -- clients can use such a context to make
calls to the various API Property/Version routes to query LMS for API versions
* moved auth to use direct `==` comparison to check for empty parameters instead
of use `in (singleItemList,)` pattern
* factored out process of fetching contents of Requests objects into a single
funtion, moved to examine `request.headers['content.type']` to determine how
to handle contents rather than just `try` to fetch r.JSON and default to
* repaired `service.check_versions()` to pass the `supported_version_request_array`
as json data
* fixed `service._simple_upload()` to seek underlying buffer stream to head
position before and after read, instead of trying to seek on the byte-string
we read the stream into
* added support to the `service` library for distinguishing between anonymous and
non-anonymous user contexts, and let version calls be made with anonymous
contexts, raise errors in the case of all other calls that demand a user context
* added more grade routes for fetching 'my' grades

0.1.7 (2012-08-10)
* added `service.get_profile_by_user_id()`
* added `data.LockerItem`, `data.LockerFolder`, `data.GroupLocker` to support
locker operations
* added to suite of locker functions to the `service` module to assist with locker
operations: this includes an example of how you might want to handle the
"simple upload" process for those Valence routes that use simple file upload

0.1.6 (2012-07-13)
* Fix bug in `update_social_media_url_by_url()`... we should look
for 'url'-keyed entries, not 'name'-keyed entries

* Some documentation revisions

* Remove 'exceptions' module as not utilized

0.1.5 (2012-07-11)
* Changed `D2LStructure.as_json()` to kick back a deep-copy of the encapsulated
data, instead of a ref to the instance's internal data structure

* Bug fixes

0.1.4 (2012-07-06)
* Refactoring and re-building of the libraries: moved data-structures into
`data` module and service-related functions into `service` module;
auth-related functionality remains in `auth`

* Re-worked samples to be more in line with design for the other client

0.1.0 (2012-06-02)
* Initial version

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for D2LValence, version 0.1.10
Filename, size File type Python version Upload date Hashes
Filename, size D2LValence-0.1.10.tar.gz (22.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page