Created
August 20, 2011 15:31
-
-
Save jharjono/1159239 to your computer and use it in GitHub Desktop.
Python script to clone all watched repos that a user is watching on Github
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
#!/usr/bin/env python | |
# Script to clone all the github repos that a user is watching | |
import requests | |
import json | |
import subprocess | |
# Grab all the URLs of the watched repo | |
user = 'jharjono' | |
r = requests.get("http://github.com/api/v2/json/repos/watched/%s" % (user)) | |
repos = json.loads(r.content) | |
urls = [repo['url'] for repo in repos['repositories']] | |
# Clone them all | |
for url in urls: | |
cmd = 'git clone ' + url | |
pipe = subprocess.Popen(cmd, shell=True) | |
pipe.wait() | |
print "Finished cloning %d watched repos!" % (len(urls)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment