-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGithubIssues.py
More file actions
42 lines (34 loc) · 1.11 KB
/
GithubIssues.py
File metadata and controls
42 lines (34 loc) · 1.11 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
import requests
import sys
#getting url response using requests API
def get_responses(url):
r = requests.get(url)
response = r.json()
return response['total_count']
#main function
if __name__ == '__main__':
statistics = {}
username = (input("\nEnter github username\n"))
url = "https://api.github.com/search/issues?q=author:" + username + "+type:"
url1 = url + "issue"
url2 = url + "issue+is:closed"
url3 = url + "issue+is:open"
url4 = url + "pr"
url5 = url + "pr+is:open"
url6 = url + "pr+is:closed+is:unmerged"
url7 = url + "pr+is:closed+is:merged"
try:
statistics['Total Issues'] = get_responses(url1)
statistics['Closed Issues'] = get_responses(url2)
statistics['Open Issues'] = get_responses(url3)
statistics['Open PRs'] = get_responses(url5)
statistics['Unmerged PRs'] = get_responses(url6)
statistics['Merged PRs'] = get_responses(url7)
statistics['Total PRs'] = get_responses(url4)
except:
print("Check if username is valid/internet connection")
sys.exit()
print("Statistics for user " + str(username))
for key,value in statistics.items():
print(str(key) + " : " + str(value))
print()