#NEWLINE# def spendables_for_address( self , address ) : #NEWLINE# #INDENT# '\n        Return a list of Spendable objects for the\n        given bitcoin address.\n        ' #NEWLINE# url_append = ( 'unspent/%s' % address ) #NEWLINE# URL = self . base_url ( ( '/address/%s' % url_append ) ) #NEWLINE# r = json . loads ( urlopen ( URL ) . read ( ) . decode ( 'utf8' ) ) #NEWLINE# spendables = [ ] #NEWLINE# for u in r . get ( 'data' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'unspent' , [ ] ) : #NEWLINE# #INDENT# coin_value = btc_to_satoshi ( u . get ( 'amount' ) ) #NEWLINE# script = h2b ( u . get ( 'script' ) ) #NEWLINE# previous_hash = h2b_rev ( u . get ( 'tx' ) ) #NEWLINE# previous_index = u . get ( 'n' ) #NEWLINE# spendables . append ( Spendable ( coin_value , spendables , previous_hash , previous_index ) ) #NEWLINE# #UNINDENT# return spendables