##// END OF EJS Templates
Defer import of json
Thomas Kluyver -
Show More
@@ -15,7 +15,6 b''
15 15 # Stdlib
16 16 import inspect
17 17 import io
18 import json
19 18 import os
20 19 import re
21 20 import sys
@@ -140,6 +139,8 b' class CodeMagics(Magics):'
140 139 print e.args[0]
141 140 return
142 141
142 from urllib2 import urlopen # Deferred import
143 import json
143 144 post_data = json.dumps({
144 145 "description": opts.get('d', "Pasted from IPython"),
145 146 "public": True,
@@ -150,7 +151,6 b' class CodeMagics(Magics):'
150 151 }
151 152 }).encode('utf-8')
152 153
153 from urllib2 import urlopen # Deferred import
154 154 response = urlopen("https://api.github.com/gists", post_data)
155 155 response_data = json.loads(response.read().decode('utf-8'))
156 156 return response_data['html_url']
General Comments 0
You need to be logged in to leave comments. Login now