当前位置: 首页>>代码示例>>Python>>正文


Python utils.url_path_join方法代码示例

本文整理汇总了Python中jupyterhub.utils.url_path_join方法的典型用法代码示例。如果您正苦于以下问题:Python utils.url_path_join方法的具体用法?Python utils.url_path_join怎么用?Python utils.url_path_join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jupyterhub.utils的用法示例。


在下文中一共展示了utils.url_path_join方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def get(self):
        consumer_token = ConsumerToken(
            self.authenticator.client_id,
            self.authenticator.client_secret,
        )

        handshaker = Handshaker(
            self.authenticator.mw_index_url, consumer_token
        )

        redirect, request_token = await wrap_future(
            self.authenticator.executor.submit(handshaker.initiate)
        )

        self.set_secure_cookie(
            AUTH_REQUEST_COOKIE_NAME,
            jsonify(request_token),
            expires_days=1,
            path=url_path_join(self.base_url, 'hub', 'oauth_callback'),
            httponly=True)
        self.log.info('oauth redirect: %r', redirect)

        self.redirect(redirect) 
开发者ID:jupyterhub,项目名称:oauthenticator,代码行数:25,代码来源:mediawiki.py

示例2: user_for_token

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def user_for_token(self, token, use_cache=True):
        """Ask the Hub to identify the user for a given token.
        Args:
            token (str): the token
            use_cache (bool): Specify use_cache=False to skip cached cookie values (default: True)
        Returns:
            user_model (dict): The user model, if a user is identified, None if authentication fails.
            The 'name' field contains the user's name.
        """
        return self._check_hub_authorization(
            url=url_path_join(self.api_url,
                "authorizations/token",
                quote(token, safe='')),
            cache_key='token:%s' % token,
            use_cache=use_cache,
        ) 
开发者ID:HDI-Project,项目名称:FeatureHub,代码行数:18,代码来源:future.py

示例3: test_start_stop

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def test_start_stop(app):
    name = "somebody"
    add_user(app.db, app, name=name)
    user = app.users[name]
    assert isinstance(user.spawner, SwarmSpawner)
    token = user.new_api_token()
    # start the server
    r = yield api_request(app, "users", name, "server", method="post")
    while r.status_code == 202:
        # request again
        r = yield api_request(app, "users", name, "server", method="post")
    assert r.status_code == 201, r.text
    url = url_path_join(public_url(app, user), "api/status")
    r = yield async_requests.get(url, headers={"Authorization": "token %s" % token})
    assert r.url == url
    r.raise_for_status()
    print(r.text)
    assert "kernels" in r.json() 
开发者ID:jupyterhub,项目名称:dockerspawner,代码行数:20,代码来源:test_swarmspawner.py

示例4: test_start_stop

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def test_start_stop(app):
    name = "has@"
    add_user(app.db, app, name=name)
    user = app.users[name]
    assert isinstance(user.spawner, DockerSpawner)
    token = user.new_api_token()
    # start the server
    r = yield api_request(app, "users", name, "server", method="post")
    while r.status_code == 202:
        # request again
        r = yield api_request(app, "users", name, "server", method="post")
        yield gen.sleep(0.1)
    assert r.status_code == 201, r.text
    url = url_path_join(public_url(app, user), "api/status")
    r = yield async_requests.get(url, headers={"Authorization": "token %s" % token})
    assert r.url == url
    r.raise_for_status()
    print(r.text)
    assert "kernels" in r.json() 
开发者ID:jupyterhub,项目名称:dockerspawner,代码行数:21,代码来源:test_dockerspawner.py

示例5: test_start_stop

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def test_start_stop(app):
    name = getuser()
    add_user(app.db, app, name=name)
    user = app.users[name]
    assert isinstance(user.spawner, SystemUserSpawner)
    token = user.new_api_token()
    # start the server
    r = yield api_request(app, "users", name, "server", method="post")
    while r.status_code == 202:
        # request again
        r = yield api_request(app, "users", name, "server", method="post")
    assert r.status_code == 201, r.text
    url = url_path_join(public_url(app, user), "api/status")
    r = yield async_requests.get(url, headers={"Authorization": "token %s" % token})
    assert r.url == url
    r.raise_for_status()
    print(r.text)
    assert "kernels" in r.json() 
开发者ID:jupyterhub,项目名称:dockerspawner,代码行数:20,代码来源:test_systemuserspawner.py

示例6: logout_url

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def logout_url(self, base_url):
        return url_path_join(base_url, 'logout') 
开发者ID:jupyterhub,项目名称:oauthenticator,代码行数:4,代码来源:globus.py

示例7: guess_callback_uri

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def guess_callback_uri(protocol, host, hub_server_url):
    return '{proto}://{host}{path}'.format(
        proto=protocol, host=host, path=url_path_join(hub_server_url, 'oauth_callback')
    ) 
开发者ID:jupyterhub,项目名称:oauthenticator,代码行数:6,代码来源:oauth2.py

示例8: get_next_url

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [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') 
开发者ID:jupyterhub,项目名称:oauthenticator,代码行数:13,代码来源:oauth2.py

示例9: login_url

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def login_url(self, base_url):
        return url_path_join(base_url, 'oauth_login') 
开发者ID:jupyterhub,项目名称:oauthenticator,代码行数:4,代码来源:oauth2.py

示例10: callback_url

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def callback_url(self, base_url):
        return url_path_join(base_url, 'kdc_callback') 
开发者ID:bloomberg,项目名称:jupyterhub-kdcauthenticator,代码行数:4,代码来源:kdcauthenticator.py

示例11: login_url

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def login_url(self, base_url):
        return url_path_join(base_url, 'kdc_login') 
开发者ID:bloomberg,项目名称:jupyterhub-kdcauthenticator,代码行数:4,代码来源:kdcauthenticator.py

示例12: init_tornado_settings

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def init_tornado_settings(self):
        """Initialize tornado config"""
        jinja_options = dict(
            autoescape=True,
        )
        jinja_env = Environment(
            loader=FileSystemLoader(self.template_paths),
            **jinja_options
        )

        # if running from git directory, disable caching of require.js
        # otherwise cache based on server start time
        parent = os.path.dirname(ROOT)
        if os.path.isdir(os.path.join(parent, '.git')):
            version_hash = ''
        else:
            version_hash=datetime.now().strftime("%Y%m%d%H%M%S"),

        settings = dict(
            log_function=log_request,
            config=self.config,
            log=self.log,
            base_url=self.base_url,
            hub_auth = self.hub_auth,
            login_url=self.hub_auth.login_url,
            hub_base_url = self.hub_base_url,
            logout_url=url_path_join(self.hub_base_url, 'hub/logout'),
            static_path=STATIC_FILES_DIR,
            static_url_prefix=url_path_join(self.base_url, 'static/'),
            template_path=self.template_paths,
            jinja2_env=jinja_env,
            version_hash=version_hash,
            xsrf_cookies=True,
        )
        # allow configured settings to have priority
        settings.update(self.tornado_settings)
        self.tornado_settings = settings 
开发者ID:jupyterhub,项目名称:hubshare,代码行数:39,代码来源:app.py

示例13: init_handlers

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def init_handlers(self):
        """Load hubshare's tornado request handlers"""
        self.handlers = []
        for handler in handlers.default_handlers + apihandlers.default_handlers:
            for url in handler.urls:
                self.handlers.append((url_path_join(self.base_url, url), handler))
        self.handlers.append((r'.*', handlers.Template404)) 
开发者ID:jupyterhub,项目名称:hubshare,代码行数:9,代码来源:app.py

示例14: get

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def get(self):
    path = self.request.path
    if path == "/about/":
        html = self.render_template("about.html", **{"active": "about"})
        self.finish(html)
    elif path == "/terms_of_use/":
        html = self.render_template("terms_of_use.html", **{"active": "terms_of_use"})
        self.finish(html)
    elif path == "/faq/":
        html = self.render_template("faq.html", **{"active": "faq"})
        self.finish(html)
    elif path == "/":
        if self.get_cookie(ORC_LOGIN_COOKIE_NAME):
            self.redirect("/hub/home")
        else:
            html = self.render_template("orc_home.html", **{"active": "home"})
            self.finish(html)
    else:
        # below is taken from original get method
        uri = self.request.uri
        # Since self.base_url will end with trailing slash.
        # Ensure uri will end with trailing slash when matching
        # with self.base_url.
        if not uri.endswith('/'):
            uri += '/'
        if uri.startswith(self.base_url):
            path = self.request.uri[len(self.base_url):]
        else:
            path = self.request.path
        if not path:
            # default / -> /hub/ redirect
            # avoiding extra hop through /hub
            path = '/'
        self.redirect(url_path_join(self.hub.base_url, path), permanent=False) 
开发者ID:gesiscss,项目名称:orc,代码行数:36,代码来源:jupyterhub_config.py

示例15: login_url

# 需要导入模块: from jupyterhub import utils [as 别名]
# 或者: from jupyterhub.utils import url_path_join [as 别名]
def login_url(self, base_url):
        return url_path_join(base_url, '/lti/launch') 
开发者ID:jupyterhub,项目名称:ltiauthenticator,代码行数:4,代码来源:__init__.py


注:本文中的jupyterhub.utils.url_path_join方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。