In [17]:
import csv
In [23]:
import csv
users = []
f = open('data.csv', 'r', encoding='utf-8')
rdr = csv.reader(f)
for line in rdr:
users.append({
"name": line[0],
"id": line[1],
"repo": line[2],
})
f.close()
users
Out[23]:
In [1]:
import requests
In [30]:
def countCommits(commits):
count = 0;
for commit in commits:
count += 1
return count
def getLastDate(commits):
return commits[0]['commit']['author']['date']
In [42]:
def readGithub(user):
cmd = "/repos/" + user["id"] + "/ml-squad/commits"
res = requests.get(url + cmd)
if res.status_code == 200:
commits = res.json()
user['count'] = countCommits(commits)
user['last_commit'] = getLastDate(commits)
else:
user['count'] = -1
user['last_commit'] = "Some Error"
In [43]:
for user in users:
readGithub(user)
users
Out[43]:
In [40]:
cmd = "/repos/" + "honux77" + "/ml-squad/commits"
res = requests.get(url + cmd)