Hi,

Is it possible to search for notebooks in Jupyter hub.

I know its is not there by default has any one tried to implement it? 

Here is a piece of python code which I used to search by generating a json 
of ipynb notebook and link it to my proxy link,

'''
Task : To search for a particular notebook link in jupyter notebook

Author : Vigneshwer

Date : 14th July 2016

Version : 1.0

'''

#loading modules 
import os 
import fnmatch
import json

#search location and extension
dir_location = "./"
search_ext = "ipynb"

#proxy link
proxy_link = "http://example.com/hub/";

#list of ipython note book names
list_ipynb_name = {}

#searching for all files named .ipynb and saving in a json format
for root, dirs, files in os.walk(dir_location):
for file_name in files:
if fnmatch.fnmatch(file_name,"*."+search_ext):
list_ipynb_name[file_name.split(".")[0]] = proxy_link + 
str(root[len(dir_location):]) + "/" + str(file_name)

#saving to a json file
with open("ipynb_list.json", "w") as file_object:
file_object.write(json.dumps(list_ipynb_name,file_object,indent=4))

#loading from the json file
with open('ipynb_list.json') as data_file:    
    data = json.load(data_file)

#searching for a key in json file
search_query = raw_input("Enter the key to search for :-")
flag=False

for key in data.keys():
if search_query == key:
print "Ipython notebook link :- " + data[key]
flag=True
break

if not flag: 
print "Ipython Notebook not found"

Other ideas would be appreciated, would like to also integrate the logic to 
jupyter hub with a UI for people to use, perhaps using elasticsearch or 
solr.

Thanks,
Vigneshwer
@dvigneshwer

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/b9fcac1b-3652-4224-bd58-0012a51d178c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to