當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。