- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_issue_alerter.py
More file actions
Latest commit
55 lines (48 loc) · 1.86 KB
/
Copy pathgithub_issue_alerter.py
File metadata and controls
55 lines (48 loc) · 1.86 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
54
55
importrequests
importjson
fromrequests.authimportHTTPBasicAuth
importos
fromgi.repositoryimportGObject
fromgi.repositoryimportNotify
classSendNotification(GObject.Object):
def__init__(self):
super(SendNotification, self).__init__()
# lets initialise with the application name
Notify.init("myapp_name")
defsend_notification(self, title, text, file_path_to_icon=""):
n=Notify.Notification.new(title, text, file_path_to_icon)
Notify.Notification.set_timeout(n, Notify.EXPIRES_NEVER)
n.show()
my=SendNotification()
username='user'
password='password'
repo_urls= []
accepted_languages= ["JavaScript", "Python",
"Java", "TypeScript", "Go", "Kotlin", "SQL"]
foriinrange(1, 11):
reqUrl='https://api.github.com/search/issues?utf8=✓&q=is%3Aopen+is%3Aissue+label%3A"good+first+issue"&page="'+ \
str(i)+"\""
print(reqUrl)
r=requests.get(reqUrl)
if(r.ok):
repoItem=json.loads(r.textorr.content)
resultSet=repoItem.get("items")
forresultinresultSet:
repo_urls.append(result.get("repository_url"))
print(len(repo_urls))
resultSet=set()
forapiUrlinrepo_urls:
print(apiUrl)
repo_details=requests.get(apiUrl, auth=HTTPBasicAuth(username, password))
if(repo_details.ok):
repoResult=json.loads(repo_details.textorrepo_details.content)
language_details=str(repoResult.get("language", "") or"")
if(language_detailsinaccepted_languages):
resultSet.add(repoResult.get("full_name", "") +
" "+language_details+" "+str(repoResult.get("stargazers_count", "")))
else:
print(repo_details)
print("Error getting the repository!")
print(resultSet)
forresultinresultSet:
my.send_notification("Some github projects to contribute to", result)