from IPython.display import IFrame, HTML
from IPython.core.display import display, HTML
import os
!ls ~/.jupyter/lab/workspaces
workspaces = ! ls ~/.jupyter/lab/workspaces
wks = []
for wk in workspaces:
if not "labworkspaces" in wk: continue
*l, r = wk.replace("labworkspaces", "").replace(".jupyterlab-workspace", "").split("-")
wks.append("-".join(l))
wks
import urllib.parse
def list_workspaces():
workspaces = ! ls ~/.jupyter/lab/workspaces
wks = []
for wk in workspaces:
if not "labworkspaces" in wk: continue
*l, r = wk.replace("labworkspaces", "").replace(".jupyterlab-workspace", "").split("-")
wks.append("-".join(l))
html = """
<ul>
{li}
</ul>
""".format(li="\n".join(["<li><a target='_blank' href='<server:port>/lab/workspaces/{wk}'>{wk}</a></li>".format(wk=wk) for wk in wks]))
display(HTML(html))
list_workspaces()
IFrame