LTI Consumer XBlock
raw JSON → 11.2.0 verified Fri May 01 auth: no python
An XBlock for Open edX that implements the consumer side of the LTI 1.1 and LTI 1.3 Advantage specifications, enabling embedding of external tools (e.g., lab platforms, publishers) into courseware. Current version 11.2.0, released June 2025. Active development under the Open edX project with regular releases.
pip install lti-consumer-xblock Common errors
error ModuleNotFoundError: No module named 'lti_consumer_xblock' ↓
cause Incorrect import path; the package name differs from the module name.
fix
Use 'from lti_consumer import LtiConsumerXBlock' instead.
error ImportError: cannot import name 'LtiConsumerConfiguration' from 'lti_consumer.models' ↓
cause Attempting to import a non-existent model; the correct model is LtiConfiguration.
fix
Use 'from lti_consumer.models import LtiConfiguration'.
error TypeError: __init__() missing 1 required positional argument: 'location' ↓
cause LtiConsumerXBlock requires a 'location' field when instantiated outside of Open edX runtime.
fix
Provide a location string (e.g., 'block-v1:...') when constructing the XBlock.
Warnings
breaking From v11.0.0, Python 3.11 support was dropped. Only Python 3.8-3.10 are supported. ↓
fix Use Python 3.8, 3.9, or 3.10.
breaking From v10.0.0, Python 3.11 support was dropped, and the library now requires Django >= 3.2. ↓
fix Ensure Django version >= 3.2 is installed.
deprecated LTI 1.1 (lti_version='lti_1p1') is considered deprecated; LTI 1.3 is recommended. ↓
fix Migrate to LTI 1.3 configuration using lti_1p3_* fields.
gotcha The xblock import module is `lti_consumer`, not `lti_consumer_xblock`. Mistaking the import path leads to ModuleNotFoundError. ↓
fix Use 'from lti_consumer import LtiConsumerXBlock'.
gotcha The LtiConfiguration model is in `lti_consumer.models`, but there is no 'LtiConsumerConfiguration' model. ↓
fix Use 'from lti_consumer.models import LtiConfiguration'.
Imports
- LtiConsumerXBlock wrong
from lti_consumer_xblock import LtiConsumerXBlockcorrectfrom lti_consumer import LtiConsumerXBlock - LtiConfiguration wrong
from lti_consumer.models import LtiConsumerConfigurationcorrectfrom lti_consumer.models import LtiConfiguration
Quickstart
from lti_consumer import LtiConsumerXBlock
# The XBlock is typically used within Open edX courseware.
# Minimal standalone usage example:
block = LtiConsumerXBlock()
block.location = 'block-v1:org+course+run+type@lti_consumer+block@lti1'
block.display_name = 'My LTI Tool'
block.lti_id = 'tool_id'
block.lti_version = 'lti_1p3'
block.lti_1p3_launch_url = 'https://example.com/lti/launch'
print('LTI Consumer XBlock instantiated successfully.')