Last active
January 3, 2017 04:51
-
-
Save rjmholt/3f8fac4e38f7e72b660bcb3f0d10eef2 to your computer and use it in GitHub Desktop.
Clones all the repos of a GitHub user, using the GitHub API
This file contains 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
#!/usr/bin/python3 | |
import urllib.request | |
import json | |
import subprocess | |
""" | |
Small python script to download all of someone's github repos | |
""" | |
GITHUB_USERNAME='' | |
if __name__ == '__main__': | |
resp = urllib.request.urlopen('https://api.github.com/users/{}/repos'.format(GITHUB_USERNAME)).read() | |
json_obj = json.loads(resp.decode('utf8')) | |
for repo in json_obj: | |
s = 'https://github.com/{}/'.format(GITHUB_USERNAME)+repo['name'] | |
subprocess.run('git clone {}'.format(s), shell=True, check=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment