-
Notifications
You must be signed in to change notification settings - Fork 1
/
createIssues.py
88 lines (75 loc) · 2.45 KB
/
createIssues.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import json
import os
import requests
import sys
from datetime import datetime, timedelta
def load_existing_data(filename):
if os.path.exists(filename):
with open(filename, 'r') as f:
return json.load(f)
return []
def create_github_issue(token, title, body):
url = "https://api.github.com/repos/noxonsu/chains/issues"
headers = {
"Authorization": f"token {token}",
"Accept": "application/vnd.github.v3+json"
}
payload = {
"title": title,
"body": body
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 201:
print(f"Successfully created Issue {title}")
else:
print(f"Failed to create issue {title}")
print(response.json())
def check_existing_issue(token, title, existing_issues_cache):
page = 1
while True:
url = f"https://api.github.com/repos/noxonsu/smartTokenlist/issues?state=all&page={page}"
headers = {
"Authorization": f"token {token}",
"Accept": "application/vnd.github.v3+json"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
issues = response.json()
if not issues:
break
for issue in issues:
existing_issues_cache.add(issue["title"])
if issue["title"] == title:
return True
page += 1
else:
break
return False
if __name__ == "__main__":
#github_token = sys.argv[1]
existing_data = load_existing_data("eth_erc20.json")
# Example of data structure
"""
{
"contract_address": "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce",
"sourceScanned": "processed",
"web_domains": [
"tokenmint.io"
],
"holders": {
"ETH": 1354770
},
"telegram_groups": [],
"p6": true
},
"""
#select only elements with p8 = true and save to eth_erc20_p8.json file
total_items_scanned = 0
filtered_data = []
for item in existing_data:
total_items_scanned += 1
if "p8" in item and item["p8"] == True:
filtered_data.append(item)
with open("eth_erc20_p8.json", "w") as f:
json.dump(filtered_data, f, indent=4)
print(f"Total items scanned: {total_items_scanned}")