Skip to content
This repository was archived by the owner on Feb 16, 2020. It is now read-only.

Commit dc413b3

Browse files
committed
Minor cosmetic changes
1 parent f04763d commit dc413b3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

etherscan-exporter.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def __init__(self):
3535
if os.environ.get('TOKENS'):
3636
self.settings['tokens'] = (json.loads(os.environ.get("TOKENS")))
3737

38-
def _get_tokens(self):
38+
def get_tokens(self):
39+
""" Gets the tokens from an account """
3940
# Ensure that we don't get blocked
4041
time.sleep(1)
4142
for account in self.accounts:
@@ -73,7 +74,8 @@ def _get_tokens(self):
7374

7475
LOG.debug('Tokens: {}'.format(self.tokens))
7576

76-
def _get_balances(self):
77+
def get_balances(self):
78+
""" Gets the current balance for an account """
7779
request_data = {
7880
'module': 'account',
7981
'action': 'balancemulti',
@@ -97,6 +99,10 @@ def _get_balances(self):
9799
})
98100
LOG.debug('Accounts: {}'.format(self.accounts))
99101

102+
def describe(self):
103+
""" Just a needed method, so that collect() isn't called at startup """
104+
return []
105+
100106
def collect(self):
101107
"""The method that actually does the collecting"""
102108
metrics = {
@@ -106,7 +112,7 @@ def collect(self):
106112
labels=['source_currency', 'currency', 'account', 'type']
107113
),
108114
}
109-
self._get_balances()
115+
self.get_balances()
110116
for account in self.accounts:
111117
metrics['account_balance'].add_metric(
112118
value=(self.accounts[account]),
@@ -118,7 +124,7 @@ def collect(self):
118124
]
119125
)
120126

121-
self._get_tokens()
127+
self.get_tokens()
122128
for token in self.tokens:
123129
metrics['account_balance'].add_metric(
124130
value=(self.tokens[token]['value']),

0 commit comments

Comments
 (0)