Skip to content

Instantly share code, notes, and snippets.

@emilengler
Last active October 31, 2018 10:49
Show Gist options
  • Save emilengler/926392371cdcabb58cbd36d723e5aca4 to your computer and use it in GitHub Desktop.
Save emilengler/926392371cdcabb58cbd36d723e5aca4 to your computer and use it in GitHub Desktop.
Download a GitHub User with all repos. Usage: python3 githubuser.py <username>
import urllib.request
import json
import sys
import os
user = sys.argv[1]
url = "https://api.github.com/users/" + user + "/repos"
urllib.request.urlretrieve(url, "json.json")
i = 0
file = open("json.json", "r")
json = json.load(file)
file.close()
while True:
try:
os.system("git clone https://github.com/" + user + "/" + json[i]["name"] + ".git")
except:
print("Done")
break
i = i + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment