Show More
@@ -267,14 +267,18 b' class CodeMagics(Magics):' | |||||
267 | print(e.args[0]) |
|
267 | print(e.args[0]) | |
268 | return |
|
268 | return | |
269 |
|
269 | |||
270 |
post_data = urlencode( |
|
270 | post_data = urlencode( | |
271 | "title": opts.get('d', "Pasted from IPython"), |
|
271 | { | |
|
272 | "title": opts.get("d", "Pasted from IPython"), | |||
272 | "syntax": "python", |
|
273 | "syntax": "python", | |
273 | "content": code |
|
274 | "content": code, | |
274 | }).encode('utf-8') |
|
275 | } | |
|
276 | ).encode("utf-8") | |||
275 |
|
277 | |||
276 |
request = Request( |
|
278 | request = Request( | |
277 | headers={"User-Agent": "IPython v{}".format(version)}) |
|
279 | "http://dpaste.com/api/v2/", | |
|
280 | headers={"User-Agent": "IPython v{}".format(version)}, | |||
|
281 | ) | |||
278 | response = urlopen(request, post_data) |
|
282 | response = urlopen(request, post_data) | |
279 | return response.headers.get('Location') |
|
283 | return response.headers.get('Location') | |
280 |
|
284 |
General Comments 0
You need to be logged in to leave comments.
Login now