Skip to content

Commit 1e57bad

Browse files
committed
drop some more ST2 stuff
1 parent 2ad8d0c commit 1e57bad

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

ipy_connection.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
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
65
import json
76
import 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):
5349
def 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]

0 commit comments

Comments
 (0)