def get_EOS_balance(account): ce = Cleos(url=eos_endpoint) EOS_balance_list = ce.get_currency_balance(account) if EOS_balance_list: EOS_balance = float(EOS_balance_list[0].split(' ')[0]) else: EOS_balance = 0 return EOS_balance
def get_EOS_balance(account): ce = Cleos(url=eos_endpoint) try: EOS_balance_list = ce.get_currency_balance(account) EOS_balance = float(EOS_balance_list[0].split(' ')[0]) except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout, json.decoder.JSONDecodeError): print("Can't get EOS balance") EOS_balance = float(0) return EOS_balance
def get_KNYGA_balance(account): ce = Cleos(url=eos_endpoint) KNYGA_balance_list = ce.get_currency_balance(account, code='knygarium111', symbol='KNYGA') if KNYGA_balance_list: KNYGA_balance = float(KNYGA_balance_list[0].split(' ')[0]) else: KNYGA_balance = 0 return KNYGA_balance
def get_KNYGA_balance(account): ce = Cleos(url=eos_endpoint) try: KNYGA_balance_list = ce.get_currency_balance(account, code='knygarium111', symbol='KNYGA') KNYGA_balance = float(KNYGA_balance_list[0].split(' ')[0]) except (requests.exceptions.HTTPError, requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout, json.decoder.JSONDecodeError): print("Can't get KNYGA balance") KNYGA_balance = float(0) return KNYGA_balance
def balance(url='http://testnet.protonchain.com:80'): ce = Cleos(url) ce = ce.get_currency_balance(account='mark1', symbol='XPR') return ce
from eospy.cleos import Cleos ce = Cleos(url='https://api.eosargentina.io') account = input('Account: ') # name of the account to search arguments = { "account": "{}".format(account), "code":"eosio.token", "symbol":"EOS", } # Get Balance of the account get_bal=ce.get_currency_balance(arguments['account'], arguments['code'], arguments['symbol']) print(get_bal)