Ai
1 Star 0 Fork 0

joyni/vscode-python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
getServerInfo.py 1.11 KB
一键复制 编辑 原始数据 按行查看 历史
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
try:
from notebook.notebookapp import list_running_servers
import json
server_list = list_running_servers()
server_info_list = []
for si in server_list:
server_info_object = {}
server_info_object["base_url"] = si["base_url"]
server_info_object["notebook_dir"] = si["notebook_dir"]
server_info_object["hostname"] = si["hostname"]
server_info_object["password"] = si["password"]
server_info_object["pid"] = si["pid"]
server_info_object["port"] = si["port"]
server_info_object["secure"] = si["secure"]
server_info_object["token"] = si["token"]
server_info_object["url"] = si["url"]
server_info_list.append(server_info_object)
print(json.dumps(server_info_list))
except Exception:
import subprocess
import sys
result = subprocess.run(
["jupyter", "notebook", "list", "--jsonlist"], capture_output=True
)
encoding = os.getenv("PYTHONIOENCODING", "utf-8")
print(result.stdout.decode(encoding))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/luluunusually/vscode-python.git
git@gitee.com:luluunusually/vscode-python.git
luluunusually
vscode-python
vscode-python
master

搜索帮助