{"id":21519,"library":"learnosity-sdk","title":"Learnosity SDK for Python","description":"The official Python SDK for integrating with the Learnosity platform. It provides tools for generating secure requests, building question and assessment UIs, and interacting with Learnosity APIs. Current version 0.3.13, released November 2024. The SDK is actively maintained, with regular minor releases.","status":"active","version":"0.3.13","language":"python","source_language":"en","source_url":"https://github.com/Learnosity/learnosity-sdk-python","tags":["learnosity","assessment","sdk","education","api"],"install":[{"cmd":"pip install learnosity-sdk","lang":"bash","label":"Standard install"},{"cmd":"pip install learnosity-sdk[quickstart]","lang":"bash","label":"Install with quickstart dependencies"}],"dependencies":[{"reason":"HTTP requests for API calls","package":"requests","optional":false},{"reason":"JWT token generation","package":"PyJWT","optional":false},{"reason":"SSL certificate validation (vendored in some versions)","package":"certifi","optional":false}],"imports":[{"note":"Init class moved to top-level package; old import still works but is deprecated.","wrong":"from learnosity_sdk.init import Init","symbol":"Init","correct":"from learnosity_sdk import Init"},{"note":"","wrong":"","symbol":"Request","correct":"from learnosity_sdk import Request"},{"note":"Version attribute is now directly in the package.","wrong":"from learnosity_sdk.version import sdk_version","symbol":"sdk_version","correct":"from learnosity_sdk import __version__"}],"quickstart":{"code":"from learnosity_sdk import Init\ninit = Init(\n    'consumer_key',\n    'consumer_secret',\n    {\n        'domain': 'localhost',\n        'user_id': 'demo_student',\n        'activity_id': 'demo_activity',\n        'session_id': 'demo_session',\n        'rendering_type': 'assess',\n        'type': 'local_practice',\n        'name': 'Demo Activity'\n    }\n)\nrequest_packet = init.generate()\nprint(request_packet)","lang":"python","description":"Instantiate the Init class with your consumer key/secret and request parameters, then generate the secure request packet."},"warnings":[{"fix":"Change import to `from learnosity_sdk import Init`.","message":"Direct import from `learnosity_sdk.init.Init` is deprecated. Use `from learnosity_sdk import Init`.","severity":"deprecated","affected_versions":">=0.3.10"},{"fix":"Use `security` instead of `security_packet`.","message":"The `security_packet` parameter in Init constructor was renamed to `security` in recent versions.","severity":"gotcha","affected_versions":">=0.3.0"},{"fix":"Upgrade Python to 3.7 or later.","message":"Python 3.6 and earlier dropped support. SDK now requires Python 3.7+.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Use the packet as returned by `init.generate()`.","message":"Do not modify the generated JSON request packet before sending; changing the structure will break authentication.","severity":"gotcha","affected_versions":"all"},{"fix":"Set the `domain` to your application's domain (e.g., 'yourcompany.com').","message":"The `domain` parameter must match the domain registered in Learnosity, otherwise requests will fail with a security error.","severity":"gotcha","affected_versions":"all"},{"fix":"Update to SDK >=0.3.11 to avoid deprecation warnings.","message":"`datetime.datetime.utcnow()` used internally in older versions; removed in 0.3.11.","severity":"deprecated","affected_versions":"<=0.3.10"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install learnosity-sdk`.","cause":"Package not installed in the current environment.","error":"ModuleNotFoundError: No module named 'learnosity_sdk'"},{"fix":"Use `from learnosity_sdk import Init` instead.","cause":"Attempting to import from a deprecated path.","error":"ImportError: cannot import name 'Init' from 'learnosity_sdk.init'"},{"fix":"Upgrade to latest version: `pip install --upgrade learnosity-sdk`.","cause":"The package is too old (pre-0.3.0) or not installed correctly.","error":"AttributeError: module 'learnosity_sdk' has no attribute 'Init'"},{"fix":"Verify your consumer key/secret and ensure you do not modify the generated packet.","cause":"Consumer secret does not match the key, or request parameters have been tampered with.","error":"learnosity_sdk.exceptions.LearnosityException: Invalid signature"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}