Created
April 12, 2017 02:16
-
-
Save anonymous/81dbf94b967ae22788a9fa3116324be2 to your computer and use it in GitHub Desktop.
This experiment shares a notebook to an anonymous gist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"nbformat":4,"nbformat_minor":2,"cells":[{"source":"# `POST` an anonymous [gist](https:\/\/developer.github.com\/v3\/gists\/)","cell_type":"markdown","metadata":{}},{"source":"filename = 'Untitled118.ipynb'","execution_count":1,"outputs":[],"cell_type":"code","metadata":{"collapsed":true}},{"source":"import ujson\nimport nbformat\nimport requests\nfrom toolz.curried import *","execution_count":8,"outputs":[],"cell_type":"code","metadata":{"collapsed":true}},{"source":"nb = nbformat.read(filename, 4)","execution_count":6,"outputs":[],"cell_type":"code","metadata":{"collapsed":false}},{"source":"resp = requests.post(\n url=\"https:\/\/api.github.com\/gists\",\n json={\n 'files': {\n filename: {\n \"content\": ujson.dumps(nb)\n }\n }\n }\n)\nprint(resp.json()['html_url'])","execution_count":29,"outputs":[{"text":"https:\/\/gist.github.com\/98e86edad023f0f3d3bbee1d44777379\n","output_type":"stream","name":"stdout"}],"cell_type":"code","metadata":{"collapsed":false}}],"metadata":{"description":"This experiment shares a notebook to an anonymous gist.","language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","pygments_lexer":"ipython3","nbconvert_exporter":"python","name":"python","mimetype":"text\/x-python","version":"3.5.2"},"kernelspec":{"display_name":"root","name":"root","language":"python"},"anaconda-cloud":{}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment