Skip to content

Instantly share code, notes, and snippets.

@its-a-feature
Forked from leoloobeek/get_gists.py
Created November 2, 2017 21:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save its-a-feature/267aafaed11acfe0c07d3b6cb33f011a to your computer and use it in GitHub Desktop.
Save its-a-feature/267aafaed11acfe0c07d3b6cb33f011a to your computer and use it in GitHub Desktop.
Download all gists for a specific user
# 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']))
@udev
Copy link

udev commented Oct 4, 2018

Beautiful! Thank you. This worked like a charm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment