Skip to content

Commit 3c0cdab

Browse files
committed
[Fix] [Qol] Add empty files for ethscan
Previously we keep checking even if determined empty in the past
1 parent 30916cd commit 3c0cdab

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

main.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,28 @@ def getLabel(label, label_type="account", input_type='single'):
110110
# Quickfix: Optimism uses etherscan subcat style but differing address format
111111
if targetChain == 'eth':
112112
#print('addressList',addressList)
113+
113114
# Replace address column in newTable dataframe with addressList
114-
curTable['Address'] = addressList
115+
if label_type == "account":
116+
curTable['Address'] = addressList
117+
elif label_type == "token":
118+
curTable["Contract Address"] = addressList
115119

116120
# Replace with Token Name only if it exists
117121
if len(tokenNameList): curTable['Token Name'] = tokenNameList
118122
except Exception as e:
119-
print(e)
123+
print(e)
120124
print(label, "Skipping label due to error")
125+
126+
# Save empty CSV and JSON, assumption is that its "No table found error"
127+
# TODO: Better error checking
128+
empty_df = pd.DataFrame()
129+
empty_df.to_csv(
130+
savePath + '{}s/empty/{}.csv'.format(label_type, label))
131+
132+
empty_dict = {}
133+
with open(savePath + '{}s/empty/{}.json'.format(label_type, label), 'w', encoding='utf-8') as f:
134+
json.dump(empty_dict, f, ensure_ascii=True)
121135
return
122136

123137
table_list.append(curTable)

0 commit comments

Comments
 (0)