Skip to content

Instantly share code, notes, and snippets.

@dynamitechetan
Last active July 1, 2017 14:15
Show Gist options
  • Save dynamitechetan/eac29e97dde4b9cd4da42009711a518e to your computer and use it in GitHub Desktop.
Save dynamitechetan/eac29e97dde4b9cd4da42009711a518e to your computer and use it in GitHub Desktop.
import requests
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-u", "--username", dest="username",
help="Enter your Github Username", metavar="USER")
parser.add_option("-d", "--date",
dest="date",
help="Today's Date")
(options, args) = parser.parse_args()
if not options.username: # if username is not given
parser.error('username not given, enter -u <username>')
if not options.date: # if date is not given
parser.error('date not given, enter -d 2017-07-01')
print ("[SCRUM] "+ str(options.username)+ " -SUSI.AI "+ str(options.date) + " False")
r = requests.get('https://api.github.com/users/'+ options.username +'/events/public')
r.json()
output_dict = [x for x in r.json() if x['created_at'].find(options.date)>=0]
# print output_dict
for i in range(len(output_dict)):
if(output_dict[i]["type"]=="IssueCommentEvent"):
print("Commented On Issue "+ output_dict[i]["payload"]['issue']['html_url']);
if(output_dict[i]["type"]=="PushEvent"):
print("Pushed Commits to "+ output_dict[i]["repo"]['name'] +" at "+ output_dict[i]["payload"]['ref']);
if(output_dict[i]["type"]=="PullRequestEvent"):
print("Opened PR#"+ str(output_dict[i]["payload"]["pull_request"]['number']) +" - "+ output_dict[i]["payload"]["pull_request"]['title'] + " at " + output_dict[i]["repo"]['name'] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment