2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Plugin etherscan_balance_: fix style issues; change to python3

This commit is contained in:
Lars Kruse 2018-03-27 04:59:57 +02:00
parent 86692d7021
commit 23811e3490

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
=head1 NAME =head1 NAME
@ -86,7 +86,8 @@ if command == 'config':
print("wei_balance_{}.label ETH".format(eth_address)) print("wei_balance_{}.label ETH".format(eth_address))
sys.exit(0) sys.exit(0)
ethercan_balance_api_url = 'https://api.etherscan.io/api?module=account&action=balance&tag=latest&address=' + eth_address ethercan_balance_api_url = ('https://api.etherscan.io/api'
'?module=account&action=balance&tag=latest&address=' + eth_address)
etherscan_req = Request(ethercan_balance_api_url) etherscan_req = Request(ethercan_balance_api_url)
# User-Agent to bypass Cloudflare # User-Agent to bypass Cloudflare
@ -109,8 +110,8 @@ except ValueError:
try: try:
eth = int(etherscan_balance['result']) eth = int(etherscan_balance['result'])
except: except (KeyError, ValueError) as exc:
print("JSON result error!", file=sys.stderr) print("JSON result error!", file=sys.stderr)
sys.exit(9) sys.exit(9)
print("wei_balance_{}.value {}".format(eth_address, eth)); print("wei_balance_{}.value {}".format(eth_address, eth))