<s> from __future__ import unicode_literals <EOL> import balanced <EOL> api_key = balanced . APIKey ( ) . save ( ) <EOL> balanced . configure ( api_key . secret ) <EOL> marketplace = balanced . Marketplace ( ) . save ( ) <EOL> declined_card = balanced . Card ( <EOL> number = '<STR_LIT>' , <EOL> expiration_month = '<STR_LIT>' , <EOL> expiration_year = '<STR_LIT>' , <EOL> ) . save ( ) <EOL> bank_account = balanced . BankAccount ( <EOL> account_number = '<STR_LIT>' , <EOL> routing_number = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> ) . save ( ) <EOL> try : <EOL> declined_card . debit ( amount = <NUM_LIT:100> ) <EOL> except balanced . exc . BalancedError as ex : <EOL> assert ex . category_code == '<STR_LIT>' <EOL> try : <EOL> bank_account . credit ( amount = <NUM_LIT:1000> ) <EOL> except balanced . exc . HTTPError as ex : <EOL> assert ex . category_code == '<STR_LIT>' <EOL> try : <EOL> balanced . Card ( ) . save ( ) <EOL> except balanced . exc . BalancedError as ex : <EOL> assert ex . category_code == '<STR_LIT>' <EOL> print ex . extras <EOL> print ex . request_id </s>
