本文整理汇总了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)
示例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)
示例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)