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
| def download_from_gist(gist_id, outdir=None, encoding='utf-8'): | |
| import json, os | |
| from urllib.request import urlopen | |
| gist_api = urlopen("https://api.github.com/gists/" + gist_id) | |
| gist_json = json.load(gist_api) | |
| gist_src = {filename: urlopen(metadata['raw_url']).read().decode(encoding) for filename, metadata in gist_json['files'].items()} | |
| if outdir is None: | |
| from tempfile import mkdtemp |