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


Python CloudHost.notebook_websocket_hostname方法代码示例

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


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

示例1: setup_instance_config

# 需要导入模块: from cloud.aws import CloudHost [as 别名]
# 或者: from cloud.aws.CloudHost import notebook_websocket_hostname [as 别名]
 def setup_instance_config(self, profiles=('julia', 'jboxjulia')):
     for profile in profiles:
         profile_path = '.ipython/profile_' + profile
         profile_path = os.path.join(self.disk_path, profile_path)
         if not os.path.exists(profile_path):
             continue
         nbconfig = os.path.join(profile_path, 'ipython_notebook_config.py')
         wsock_cfg = "c.NotebookApp.websocket_url = '" + JBoxVol.NOTEBOOK_WEBSOCK_PROTO + \
                     CloudHost.notebook_websocket_hostname() + "'\n"
         JBoxVol.replace_in_file(nbconfig, "c.NotebookApp.websocket_url", wsock_cfg)
开发者ID:dingliumath,项目名称:JuliaBox,代码行数:12,代码来源:jbox_volume.py

示例2: setup_instance_config

# 需要导入模块: from cloud.aws import CloudHost [as 别名]
# 或者: from cloud.aws.CloudHost import notebook_websocket_hostname [as 别名]
    def setup_instance_config(self):
        nbconfig = os.path.join(self.disk_path, '.ipython/profile_julia/ipython_notebook_config.py')
        nbconfig_temp = os.path.join(self.disk_path, '.ipython/profile_julia/ipython_notebook_config.py.temp')

        if os.path.exists(nbconfig_temp):
            os.remove(nbconfig_temp)
        os.rename(nbconfig, nbconfig_temp)

        wsock_cfg = "c.NotebookApp.websocket_url = 'wss://" + CloudHost.notebook_websocket_hostname() + "'\n"

        replaced = False
        with open(nbconfig_temp) as fin, open(nbconfig, 'w') as fout:
            for line in fin:
                if line.startswith("c.NotebookApp.websocket_url"):
                    line = wsock_cfg
                    replaced = True
                fout.write(line)
            if not replaced:
                fout.write(wsock_cfg)
开发者ID:melvin0008,项目名称:JuliaBox,代码行数:21,代码来源:jbox_volume.py

示例3: get

# 需要导入模块: from cloud.aws import CloudHost [as 别名]
# 或者: from cloud.aws.CloudHost import notebook_websocket_hostname [as 别名]
    def get(self):
        args = self.get_argument('m', default=None)

        if args is not None:
            args = json.loads(decrypt(base64.b64decode(args), self.config(key='sesskey')))

        if args is not None:
            self.log_debug("setting cookies")
            for cname in ['sessname', 'hostshell', 'hostupload', 'hostipnb', 'sign', 'juliabox']:
                self.set_cookie(cname, args[cname])
            self.set_status(status_code=204)
            self.finish()
        else:
            args = dict()
            for cname in ['sessname', 'hostshell', 'hostupload', 'hostipnb', 'sign', 'juliabox']:
                args[cname] = self.get_cookie(cname)
            args = tornado.escape.url_escape(base64.b64encode(encrypt(json.dumps(args), self.config(key='sesskey'))))
            url = "//" + CloudHost.notebook_websocket_hostname() + "/cors/?m=" + args
            self.log_debug("redirecting to " + url)
            self.redirect(url)
开发者ID:arshak,项目名称:JuliaBox,代码行数:22,代码来源:cors.py


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