Skip to content

Instantly share code, notes, and snippets.

@ShannonScott
Forked from leoloobeek/get_gists.py
Last active July 25, 2019 22:22
Show Gist options
  • Save ShannonScott/92b3457306e2aed74d216f3e4cf9575f to your computer and use it in GitHub Desktop.
Save ShannonScott/92b3457306e2aed74d216f3e4cf9575f to your computer and use it in GitHub Desktop.
[Download Gists] Download all gists for a specific user. #gist #github #forked
# first: mkdir user && cd user && cp /path/to/get_gists.py .
# python3 get_gists.py user
import requests
import sys
from subprocess import call
user = sys.argv[1]
r = requests.get('https://api.github.com/users/{0}/gists'.format(user))
for i in r.json():
call(['git', 'clone', i['git_pull_url']])
description_file = './{0}/description.txt'.format(i['id'])
with open(description_file, 'w') as f:
f.write('{0}\n'.format(i['description']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment