Created
September 3, 2018 06:27
-
-
Save ashishmohite/757abf19f210e1f2c92b2c7aaa92d1f3 to your computer and use it in GitHub Desktop.
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
import json | |
import subprocess, shlex | |
private_token = "mytoken" | |
groups = requests.get("https://[host]/api/v3/groups/?private_token={}".format(private_token)).json() | |
for group in groups: | |
print("=============================") | |
print(group) | |
projects = requests.get("https://[host]/api/v3/groups/{}/projects?private_token={}".format(group["id"], private_token)) | |
for project in projects.json(): | |
projectURL = project['ssh_url_to_repo'] | |
try: | |
command = shlex.split('git clone %s' % projectURL) | |
resultCode = subprocess.Popen(command) | |
except Exception as e: | |
print("Error on %s: %s" % (projectURL, e.__str__())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment