Last active
February 18, 2016 16:50
-
-
Save mrandi/e64ac304788d858ce9cc to your computer and use it in GitHub Desktop.
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 python3 | |
from pprint import pprint | |
import requests | |
import json | |
import os | |
USER='XXX' | |
API_TOKEN='XXX' | |
GIT_API_URL='https://api.github.com' | |
def get_api(url): | |
try: | |
headers = {'Authorization': 'token %s' % API_TOKEN} | |
response = requests.get(GIT_API_URL + url, headers=headers) | |
for element in response.json(): | |
pprint(element['ssh_url']) | |
cmd = 'git clone ' + element['ssh_url'] | |
os.system(cmd) | |
except: | |
pprint("Exception %s" % url) | |
raise e | |
def get_repo(): | |
pprint("get Org for stups") | |
get_api("/orgs/:org/repos") | |
get_repo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment