File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22# Copyright (c) 2013, Maxim Grechkin
33# This file is licensed under GNU General Public License version 3
44# See COPYING for details.
5- from __future__ import print_function
65import json
76import uuid
87
@@ -38,11 +37,8 @@ def get_notebooks(baseurl):
3837 target_url = "http://%s/notebooks" % baseurl
3938 try :
4039 req = urlopen (target_url )
41- try :
42- encoding = req .headers .get_content_charset ()
43- body = req .readall ().decode (encoding )
44- except AttributeError :
45- body = req .read ()
40+ encoding = req .headers .get_content_charset ()
41+ body = req .readall ().decode (encoding )
4642 data = json .loads (body )
4743 return data
4844 except Exception as e :
@@ -53,12 +49,8 @@ def get_notebooks(baseurl):
5349def create_new_notebook (baseurl ):
5450 try :
5551 req = urlopen ("http://" + baseurl + "/new" )
56- try :
57- encoding = req .headers .get_content_charset ()
58- body = req .readall ().decode (encoding )
59- except AttributeError :
60- encoding = req .headers .getparam ('charset' )
61- body = req .read ()
52+ encoding = req .headers .get_content_charset ()
53+ body = req .readall ().decode (encoding )
6254 import re
6355 match = re .search ("data-notebook-id=(.*)" , body )
6456 nbid = match .groups ()[0 ]
You can’t perform that action at this time.
0 commit comments