Skip to main content

A python library for building and/or consuming LTI apps

Project description

https://travis-ci.org/pylti/lti.svg?branch=master https://codecov.io/gh/pylti/lti/branch/master/graph/badge.svg Join the chat at https://gitter.im/pylti/lti

lti is a Python library implementing the Learning Tools Interperability (LTI) standard. It is based on dce_lti_py, which is based on ims_lti_py.

Installation

pip install lti

Dependencies

Usage

The primary goal of this library is to provide classes for building Python LTI tool providers (LTI apps). To that end, the functionality that you’re looking for is probably in the ToolConfig and ToolProvider classes.

Tool Config Example (Django)

Here’s an example of a Django view you might use as the configuration URL when registering your app with the LTI consumer.

from lti import ToolConfig
from django.http import HttpResponse


def tool_config(request):

    # basic stuff
    app_title = 'My App'
    app_description = 'An example LTI App'
    launch_view_name = 'lti_launch'
    launch_url = request.build_absolute_uri(reverse('lti_launch'))

    # maybe you've got some extensions
    extensions = {
        'my_extensions_provider': {
            # extension settings...
        }
    }

    lti_tool_config = ToolConfig(
        title=app_title,
        launch_url=launch_url,
        secure_launch_url=launch_url,
        extensions=extensions,
        description = app_description
    )

    return HttpResponse(lti_tool_config.to_xml(), content_type='text/xml')

Tool Provider OAuth Request Validation Example (Django)

from lti.contrib.django import DjangoToolProvider
from my_app import RequestValidator


# create the tool provider instance
tool_provider = DjangoToolProvider.from_django_request(request=request)

# the tool provider uses the 'oauthlib' library which requires an instance
# of a validator class when doing the oauth request signature checking.
# see https://oauthlib.readthedocs.org/en/latest/oauth1/validator.html for
# info on how to create one
validator = RequestValidator()

# validate the oauth request signature
ok = tool_provider.is_valid_request(validator)

# do stuff if ok / not ok

Testing

Unit tests can be run by executing

tox

This uses tox to set up and run the test environment.

Project details


Download files

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

Source Distribution

lti-0.8.3.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

lti-0.8.3-py2.py3-none-any.whl (19.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file lti-0.8.3.tar.gz.

File metadata

  • Download URL: lti-0.8.3.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lti-0.8.3.tar.gz
Algorithm Hash digest
SHA256 1f51682f1c134675403018355d6d838829c132175115c44ff4d5970e29730397
MD5 241cef83230bf0053d3b11482b2c9f6a
BLAKE2b-256 6489045ed749d8de1341190dc37aa23995c9105ca6e2761404c04bf3c7b9ec8b

See more details on using hashes here.

File details

Details for the file lti-0.8.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for lti-0.8.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3cebb3931cca3e7eb0a196bb0e9eee91ca4cfe0acc5f078dae7b57e6ec51b7e7
MD5 0ff050ca94bac55c504952327e8cc4c2
BLAKE2b-256 7c5f1d502ad6dac20de7da7e969cc11210451568bf7415f704082c6bdc5207b1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page