{ "info": { "author": "eLIPSE", "author_email": "", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "CELTIC Python Bindings\r\n======================\r\n\r\nThis module contains a thin wrapper around the CELTIC service which\r\nallows for cross-platform LTI validation.\r\n\r\nDependencies\r\n------------\r\n\r\n- `requests `__\r\n\r\nTests\r\n-----\r\n\r\n``tox`` is used as a test runner for this library. It is configured to\r\nrun tests for py27, py35 and py36.\r\n\r\n::\r\n\r\n pip install tox\r\n tox\r\n\r\nUsage\r\n-----\r\n\r\n::\r\n\r\n from celtic_lib import get_lti_validator, LTIValidatorException\r\n\r\n LTI_LISTEN_LOCATION = \"https://localhost:8000/lti\"\r\n\r\n def handle_request(request):\r\n \"\"\"\r\n request contains some LTI payload you just received in your application \r\n \"\"\"\r\n\r\n app_key = \"some_long_unique_string_unique_to_this_application\"\r\n celtic_service_uri = \"https://location_of_celtic_service.net/\"\r\n\r\n lti_validator = get_lti_validator(celtic_service_uri, app_key)\r\n \r\n http_method = request.method # Will be \"POST\", since we are only listening on the POST endpoint\r\n try:\r\n status, result = lti_validator.validate_request(LTI_LISTEN_LOCATION, http_method, request.POST)\r\n return print(\"Request is valid and can be trusted\")\r\n except LTIValidatorException as e:\r\n return print(\"Request failed:\", e.message, \"|\", e.status_code)\r\n\r\n # router is an imaginary application router.\r\n # For purposes of this is makes the handle_lti_request function handle all POST requests which are directed at LTI_LISTEN_LOCATION\r\n router.on(LTI_LISTEN_LOCATION, \"POST\", handle_lti_request)\r\n\r\nArchitecture\r\n------------\r\n\r\nThis module is fairly straightforward, it forwards any LTI request to a\r\nsecure endpoint which contains a record of the ``oauth_consumer_key``\r\nand the ``secret_key``. This remote endpoint then validates the request,\r\nand returns a simple response indicating its validity.\r\n\r\n``DataRequester`` This class exposes a ``post`` method which takes the\r\nCELTIC service endpoint, and the POST data to send it. It returns the\r\nCELTIC response wrapped in the following interface:\r\n\r\n::\r\n\r\n * status_code\r\n * json()\r\n\r\nThe primary reason of this class is to allow users to swap out the\r\ndefault ``DataRequester`` for their own to provide better control over\r\nthe application\r\n\r\n``LTIValidator`` A class which handles the plumbing of the LTI\r\nvalidation. It is given a CELTIC service URI, an ``app_key``, and a\r\n``DataRequester`` instance. The user then only needs to call the\r\n``validate_request`` method with a forwarded LTI payload to determine\r\nthe validity of it.\r\n\r\n``LTIValidatorException`` An exception thrown when the server returns a\r\nnot-good error code about the LTI response. The exception exposes the\r\nfollowing data:\r\n\r\n::\r\n\r\n * message - The error message the CELTIC server responded with\r\n * status_code - The HTTP status code the CELTIC server responded with\r\n * errors - The response body the CELTIC service responded with\r\n\r\nDeveloping\r\n----------\r\n\r\nTo make improvements to this package, the following is required:\r\n\r\n::\r\n\r\n * A python environment\r\n * [pandoc](https://pandoc.org/installing.html) is used to convert this README.md into `reStructuredText`\r\n 1. First: pip install pypandoc\r\n 2. Second: Download installer from pandoc website\r\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "celtic_lib", "package_url": "https://pypi.org/project/celtic_lib/", "platform": "", "project_url": "https://pypi.org/project/celtic_lib/", "project_urls": null, "release_url": "https://pypi.org/project/celtic_lib/0.0.7/", "requires_dist": null, "requires_python": "", "summary": "A python library for wrapping around the CELTIC service", "version": "0.0.7" }, "last_serial": 3243775, "releases": { "0.0.5": [ { "comment_text": "", "digests": { "md5": "b844ad55ba0c666c8a31dfc3fb7d5732", "sha256": "603fbe16b47e014a728a6114a1fadb72d8ea8e3d360702986fbd6fda8b4914b7" }, "downloads": -1, "filename": "celtic_lib-0.0.5.tar.gz", "has_sig": false, "md5_digest": "b844ad55ba0c666c8a31dfc3fb7d5732", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4033, "upload_time": "2017-10-11T23:17:44", "url": "https://files.pythonhosted.org/packages/9c/5c/1e8af18e0c0bcdb569b1815e6fa02e11eb8af703730fd970552555709148/celtic_lib-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "906f09fc41693b6f55c69a287715999a", "sha256": "55f1c45f86bc7a7ed2e6c060bd3f3bb19d4f53eea9805595a88487c140180e4b" }, "downloads": -1, "filename": "celtic_lib-0.0.6.tar.gz", "has_sig": false, "md5_digest": "906f09fc41693b6f55c69a287715999a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4028, "upload_time": "2017-10-11T23:18:59", "url": "https://files.pythonhosted.org/packages/32/f2/74a553c1a5e8b5f3841185b1894c1a8f485efc6289414209139d6370e9dc/celtic_lib-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "01098970972d0f0cc823ee257a6ed393", "sha256": "53c4dd5c8399692411e14ec008a1b8d1e6cf8d391e1701a2dabd5d909706b1db" }, "downloads": -1, "filename": "celtic_lib-0.0.7.tar.gz", "has_sig": false, "md5_digest": "01098970972d0f0cc823ee257a6ed393", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4208, "upload_time": "2017-10-11T23:55:56", "url": "https://files.pythonhosted.org/packages/ce/e8/0f53fec175803c97cc6018fe6a6cc1e5d9127aae65cea53e6fe7a92c7d64/celtic_lib-0.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "01098970972d0f0cc823ee257a6ed393", "sha256": "53c4dd5c8399692411e14ec008a1b8d1e6cf8d391e1701a2dabd5d909706b1db" }, "downloads": -1, "filename": "celtic_lib-0.0.7.tar.gz", "has_sig": false, "md5_digest": "01098970972d0f0cc823ee257a6ed393", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4208, "upload_time": "2017-10-11T23:55:56", "url": "https://files.pythonhosted.org/packages/ce/e8/0f53fec175803c97cc6018fe6a6cc1e5d9127aae65cea53e6fe7a92c7d64/celtic_lib-0.0.7.tar.gz" } ] }