# verify -- cert verification flag # debug -- debug flag from conf_basic import app_config as _CFG # Callback URL for receiving user auth tokens for Valence LF API calls _AUTH_ROUTE = '/token' _AUTH_CB = '{0}://{1}:{2}{3}'.format(_CFG['scheme'], _CFG['host'], _CFG['port'], _AUTH_ROUTE) ## ---------------------------------------------------------------------------- ## Service global singleton objects for all threads in this web service _ac = d2lauth.fashion_app_context(app_id=_CFG['app_id'], app_key=_CFG['app_key']) ## Beaker middleware # set up beaker session state middleware _session_opts = {'session.type': 'memory', 'session.auto': True} # wrap the bottle app in a beaker _app = beaker.middleware.SessionMiddleware(bottle.app(), _session_opts) # hook request to make the beaker session easier to get to @hook('before_request') def _setup_request(): request.session = request.environ['beaker.session']
# lms_port -- port number for the back-end LMS # encrypt_requests -- True: use HTTPS when making API calls to the LMS # lms_ver -- product component API versions to call # verify -- cert verification flag # debug -- debug flag from conf_basic import app_config as _CFG # Callback URL for receiving user auth tokens for Valence LF API calls _AUTH_ROUTE = '/token' _AUTH_CB = '{0}://{1}:{2}{3}'.format(_CFG['scheme'], _CFG['host'], _CFG['port'], _AUTH_ROUTE) ## ---------------------------------------------------------------------------- ## Service global singleton objects for all threads in this web service _ac = d2lauth.fashion_app_context(app_id=_CFG['app_id'], app_key=_CFG['app_key']) ## Beaker middleware # set up beaker session state middleware _session_opts = {'session.type': 'memory', 'session.auto': True} # wrap the bottle app in a beaker _app = beaker.middleware.SessionMiddleware(bottle.app(), _session_opts) # hook request to make the beaker session easier to get to @hook('before_request') def _setup_request(): request.session = request.environ['beaker.session']
def get_app_context(self): global ac if ac == None: app_creds = { 'app_id': self.settings('d2l_app_id'), 'app_key': self.settings('d2l_app_key') } ac = d2lauth.fashion_app_context(app_id=app_creds['app_id'], app_key=app_creds['app_key']) return ac
# lms_port -- port number for the back-end LMS # encrypt_requests -- True: use HTTPS when making API calls to the LMS # lms_ver -- product component API versions to call # verify -- cert verification flag # debug -- debug flag from conf_basic import app_config as _CFG # Callback URL for receiving user auth tokens for Valence LF API calls _AUTH_ROUTE = "/token" _AUTH_CB = "{0}://{1}:{2}{3}".format(_CFG["scheme"], _CFG["host"], _CFG["port"], _AUTH_ROUTE) ## ---------------------------------------------------------------------------- ## Service global singleton objects for all threads in this web service _ac = d2lauth.fashion_app_context(app_id=_CFG["app_id"], app_key=_CFG["app_key"]) ## Beaker middleware # set up beaker session state middleware _session_opts = {"session.type": "memory", "session.auto": True} # wrap the bottle app in a beaker _app = beaker.middleware.SessionMiddleware(bottle.app(), _session_opts) # hook request to make the beaker session easier to get to @hook("before_request") def _setup_request(): request.session = request.environ["beaker.session"]