-
Notifications
You must be signed in to change notification settings - Fork 1
/
a-parser.py
59 lines (49 loc) · 1.53 KB
/
a-parser.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
from wallet import *
from methods import *
import warnings
warnings.filterwarnings("ignore")
memo = 'crawled by wiki crawler'
privkey = seed_to_privkey(SEED, path="m/44'/118'/0'/0/0")
address = privkey_to_address(privkey)
number = get_number(address)
sequence = get_sequence(address)
account = {
"address": address,
"privkey": privkey,
"number": number,
"sequence": sequence
}
def convert(a):
it = iter(a)
res_dct = dict(zip(it, it))
return res_dct
keywords = [line.strip(':\n') for line in open(KEY_WORDS)]
kw_dict = convert(keywords)
for key in kw_dict:
kw_dict[key] = kw_dict[key].split(',')
while ('' in kw_dict[key]):
kw_dict[key].remove('')
if (if_file_exist(PATH_TO_DF)):
df = load_df(PATH_TO_DF)
for key in kw_dict:
key = to_lower_case(key)
kw_dict[key] = to_lower_case(kw_dict[key])
df = add_data(key, kw_dict[key], df)
while (False in df['isLinked'].values):
tx = sign(account, df, memo)
save_to_csv(df, PATH_TO_DF)
broadcast(tx, account)
account['sequence'] += 1
else:
create_link_file(PATH_TO_DF)
df = load_df(PATH_TO_DF)
for key in kw_dict:
key = to_lower_case(key)
kw_dict[key] = to_lower_case(kw_dict[key])
df = add_data(key, kw_dict[key], df)
while (False in df['isLinked'].values):
tx = sign(account, df, memo)
save_to_csv(df, PATH_TO_DF)
broadcast(tx, account)
account['sequence'] += 1
save_to_csv(df, PATH_TO_DF)