Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
divyanshumehta committed May 11, 2017
0 parents commit 3f390ce
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
log.txt
Empty file added README.md
Empty file.
35 changes: 35 additions & 0 deletions tracker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import requests
import os

main_api = 'https://api.github.com/'
org = input('Enter organization name:')
repo = input('Enter repositoryname:')
url = main_api + 'repos/' + org + '/' + repo + '/issues'
print(url)
response = requests.get(url)
data = response.json()
#print(data[0]['body'])


if not os.path.exists('log.txt'):
os.system('touch log.txt')

if os.stat('log.txt').st_size == 0 :
#File is empty
file = open('log.txt','w')
for comment in data:
file.write('Issue Number: '+ '%d'%comment['number'] + '\t')
file.write('Issue Title:' + comment['title'] + '\t')
file.write('Labels: ')
for label in comment['labels']:
file.write(label['name'] + ',')
file.write('\tAuthor: ' + comment['user']['login'] + '\t')

file.write('Created at:' + '\n')
else:
# print('file is not empty')
file = open('log.txt','r+')
issue = file.readline()
# print(issue)
words = issue.split()
print('Latest Issue Number: ' + words[2])

0 comments on commit 3f390ce

Please sign in to comment.