-
Notifications
You must be signed in to change notification settings - Fork 0
/
Filter_Rule.py
34 lines (28 loc) · 990 Bytes
/
Filter_Rule.py
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
import time
import requests
repo_name = "ElyssaJyu/Auto-Digest"
first_filter_comb = ["safety", "security", "concern"]
second_filter_comb = ["data", "password", "profile"]
filter_kw = "privacy"
headers = {
"Accept": "application/vnd.github+json",
}
import json
def check_combination(list1, list2, datacontent):
for item1 in list1:
for item2 in list2:
if item1 + item2 in datacontent:
return True
return False
# Get all open issues
while True:
url = f"https://api.github.com/repos/ElyssaJyu/Auto-Digest/issues?state=open"
response = requests.get(url, headers=headers)
issues = response.json()
now = int(time.time())
time_interval = 300
start_time = now - time_interval
for issue in issues:
result = check_combination(first_filter_comb, second_filter_comb, issue)
if (result or filter_kw in issue) and issue.created_at.timestamp() >= start_time:
print(f"New issue #{issue.title}")