本文整理汇总了Python中jupyterhub.handlers.BaseHandler方法的典型用法代码示例。如果您正苦于以下问题:Python handlers.BaseHandler方法的具体用法?Python handlers.BaseHandler怎么用?Python handlers.BaseHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jupyterhub.handlers
的用法示例。
在下文中一共展示了handlers.BaseHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_next_url
# 需要导入模块: from jupyterhub import handlers [as 别名]
# 或者: from jupyterhub.handlers import BaseHandler [as 别名]
def get_next_url(self, user=None):
"""Get the redirect target from the state field"""
state = self.get_state_url()
if state:
next_url = _deserialize_state(state).get('next_url')
if next_url:
return next_url
# JupyterHub 0.8 adds default .get_next_url for a fallback
if hasattr(BaseHandler, 'get_next_url'):
return super().get_next_url(user)
return url_path_join(self.hub.server.base_url, 'home')
示例2: finish
# 需要导入模块: from jupyterhub import handlers [as 别名]
# 或者: from jupyterhub.handlers import BaseHandler [as 别名]
def finish(self):
return super(JupyterHubBaseHandler, self).finish()
示例3: post
# 需要导入模块: from jupyterhub import handlers [as 别名]
# 或者: from jupyterhub.handlers import BaseHandler [as 别名]
def post(self):
"""
Technical reference of relevance to understand this function
------------------------------------------------------------
1. Class dependencies
- jupyterhub.handlers.BaseHandler: https://github.com/jupyterhub/jupyterhub/blob/abb93ad799865a4b27f677e126ab917241e1af72/jupyterhub/handlers/base.py#L69
- tornado.web.RequestHandler: https://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler
2. Function dependencies
- login_user: https://github.com/jupyterhub/jupyterhub/blob/abb93ad799865a4b27f677e126ab917241e1af72/jupyterhub/handlers/base.py#L696-L715
login_user is defined in the JupyterHub wide BaseHandler class,
mainly wraps a call to the authenticate function and follow up.
a successful authentication with a call to auth_to_user that
persists a JupyterHub user and returns it.
- get_next_url: https://github.com/jupyterhub/jupyterhub/blob/abb93ad799865a4b27f677e126ab917241e1af72/jupyterhub/handlers/base.py#L587
- get_body_argument: https://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.get_body_argument
"""
# FIXME: Figure out if we want to pass the user returned from
# self.login_user() to self.get_next_url(). It is named
# _ for now as pyflakes is fine about having an unused
# variable named _.
_ = yield self.login_user()
next_url = self.get_next_url()
body_argument = self.get_body_argument(
name='custom_next',
default=next_url,
)
self.redirect(body_argument)