forked from StevensDeptECE/grading
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcloneGitRepos.py
More file actions
executable file
·53 lines (42 loc) · 1.1 KB
/
cloneGitRepos.py
File metadata and controls
executable file
·53 lines (42 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import urllib2
import json
from subprocess import call
import sys
course = sys.argv[1]
assignment = sys.argv[2]
index = course + '-' + assignment + '-'
print index
token = 'Insert Token Here'
url = 'https://api.github.com/orgs/StevensDeptECE/repos'
req = urllib2.Request(url)
req.add_header('Authorization', 'token %s' % token)
res = urllib2.urlopen(req)
data = json.load(res)
repoNames = []
repoIDs = []
repoClone = []
for repo in data:
repoNames.append(str(repo['name']))
repoIDs.append(str(repo['name']))
repoClone.append(str(repo['clone_url'][8:]))
users = []
dirNames = []
for i in range(0, len(repoClone)):
if index in repoClone[i]:
cmd = 'https://%s@%s' % (token, repoClone[i])
call(["git", "clone", cmd])
dirNames.append(repoNames[i])
users.append(repoNames[i].replace(index, ''))
#Grade here
#research multithreading
print users
print dirNames
'''
cmd = 'https://%s%s' % (token, repoClone[7])
call(["git", "clone", repoClone[7]])
call([token])
'''
'''
with open('jsonOut.json', 'w') as outfile:
json.dump(data, outfile)
'''