Previous topic

Getting started with PyLTI using Flask

Next topic

pylti.flask package

This Page

pylti.common package

Common classes and methods for PyLTI module

exception pylti.common.LTIException

Custom LTI exception for proper handling of LTI specific errors

exception pylti.common.LTINotInSessionException

Custom LTI exception for proper handling of LTI specific errors

class pylti.common.LTIOAuthDataStore(consumers)

Largely taken from reference implementation for app engine at https://code.google.com/p/ims-dev/

lookup_cert(key)

Search through keys

lookup_consumer(key)

Search through keys

lookup_nonce(oauth_consumer, oauth_token, nonce)

Lookup nonce should check if nonce was already used by this consumer in the past. Reusing nonce is bad: http://cwe.mitre.org/data/definitions/323.html Not implemented.

exception pylti.common.LTIPostMessageException

Exception class for when LTI user doesn’t have the right role.

exception pylti.common.LTIRoleException

Exception class for when LTI user doesn’t have the right role.

pylti.common.generate_request_xml(message_identifier_id, operation, lis_result_sourcedid, score)

Generates LTI 1.1 XML for posting result to LTI consumer.

Parameters:
  • message_identifier_id
  • operation
  • lis_result_sourcedid
  • score
Returns:

XML string

pylti.common.post_message(consumers, lti_key, url, body)
Posts a signed message to LTI consumer
Parameters:
  • consumers – consumers from config
  • lti_key – key to find appropriate consumer
  • url – post url
  • body – xml body
Returns:

success

pylti.common.post_message2(consumers, lti_key, url, body, method='POST', content_type='application/xml')
Posts a signed message to LTI consumer using LTI 2.0 format
Param:consumers: consumers from config
Param:lti_key: key to find appropriate consumer
Param:url: post url
Param:body: xml body
Returns:success
pylti.common.verify_request_common(consumers, url, method, headers, params)

Verifies that request is valid

Parameters:
  • consumers – consumers from config file
  • url – request url
  • method – request method
  • headers – request headers
  • params – request params
Returns:

is request valid