Skip to content

Commit

Permalink
Update README + version
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-viskov committed Mar 24, 2020
1 parent af8ef40 commit d0ae852
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
38 changes: 23 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ LTI 1.3 Advantage Tool implementation in Python


This project is a Python implementation of the similar `PHP tool`_.
Library contains adapters for usage from Django Web Framework and Flask Web Framework but there is no difficulty to adapt it to other frameworks: you should just re-implement ``OIDCLogin`` and ``MessageLaunch`` classes as it is already done in existing adapters.
Library contains adapters for usage from Django and Flask web frameworks but there is no difficulty to adapt it to other frameworks: you should just re-implement ``OIDCLogin`` and ``MessageLaunch`` classes as it is already done in existing adapters.

.. _PHP tool: https://github.com/IMSGlobal/lti-1-3-php-library

Expand Down Expand Up @@ -299,18 +299,25 @@ Create ``FlaskRequest`` adapter. Then create instance of ``FlaskOIDCLogin``. ``r
.. code-block:: python
from flask import request, session
from pylti1p3.flask_adapter import (FlaskCookieService, FlaskOIDCLogin,
FlaskRequest, FlaskSessionService)
from pylti1p3.flask_adapter import (FlaskRequest, FlaskOIDCLogin)
def login(request_params_dict):
tool_conf = ... # See Configuration chapter above
# FlaskRequest by default use flask.request and flask.session
# so in this case you may define request object without any arguments:
request = FlaskRequest()
# in case of using different request object (for example webargs or something like this)
# you may pass your own values:
request = FlaskRequest(
request_data=request_params_dict,
request_is_secure=request.is_secure,
cookies=request.cookies,
session=session
session=session,
request_data=request_params_dict,
request_is_secure=request.is_secure
)
oidc_login = FlaskOIDCLogin(
Expand All @@ -333,25 +340,26 @@ Create ``FlaskRequest`` adapter. Then create instance of ``FlaskMessageLaunch``.
from flask import request, session
from werkzeug.utils import redirect
from pylti1p3.flask_adapter import (FlaskCookieService, FlaskMessageLaunch,
FlaskRequest, FlaskSessionService)
from pylti1p3.flask_adapter import (FlaskRequest, FlaskMessageLaunch)
def launch(request_params_dict):
tool_conf = ... # See Configuration chapter above
request = FlaskRequest()
# or
request = FlaskRequest(
request_data=request_params_dict,
request_is_secure=request.is_secure,
cookies=request.cookies,
session=session
cookies=...,
session=...,
request_data=...,
request_is_secure=...
)
message_launch = FlaskMessageLaunch(
request=request,
tool_config=tool_conf,
session_service=FlaskSessionService(request),
cookie_service=FlaskCookieService(request)
tool_config=tool_conf
)
email = message_launch.get_launch_data().get('email')
Expand Down
2 changes: 1 addition & 1 deletion pylti1p3/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.3.3'
__version__ = '1.4.0'

0 comments on commit d0ae852

Please sign in to comment.