#NEWLINE# def get_balance_multi( self , crypto , addresses , confirmations = 1 ) : #NEWLINE# #INDENT# url = 'https://www.blockonomics.co/api/balance' #NEWLINE# if ( hasattr ( addresses , 'startswith' ) and addresses . startswith ( 'xpub' ) ) : #NEWLINE# #INDENT# body = { #NEWLINE# #INDENT# 'addr' : addresses , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# body = { #NEWLINE# #INDENT# 'addr' : ' ' . join ( addresses ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# response = self . post_url ( url , json . dumps ( body ) ) . json ( ) #NEWLINE# balances = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for data in response [ 'response' ] : #NEWLINE# #INDENT# confirmed = ( data [ 'confirmed' ] / 100000000.0 ) #NEWLINE# if ( confirmations == 0 ) : #NEWLINE# #INDENT# balance = ( confirmed + ( data [ 'unconfirmed' ] / 100000000.0 ) ) #NEWLINE# #UNINDENT# if ( confirmations == 1 ) : #NEWLINE# #INDENT# balance = confirmed #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise SkipThisService ( "Can't filter by confirmations" ) #NEWLINE# #UNINDENT# balances [ data [ 'addr' ] ] = balance #NEWLINE# #UNINDENT# return balances