passing dictionay as argument
Arshpreet Singh
arsh840 at gmail.com
Mon Jun 13 06:54:27 EDT 2016
I have to pass dictionary as function argument for following code:
</code>
import authorize
authorize.Configuration.configure(
authorize.Environment.TEST,
'api_login_id',
'api_transaction_key',
)
result = authorize.Transaction.sale({
'amount': 40.00,
'credit_card': {
'card_number': '4111111111111111',
'expiration_date': '04/2014',
'card_code': '343',
}
})
result.transaction_response.trans_id
</code>
I want to define 'credit-card' dictionary as argument in the function as follows but it returns syntax error:
</code>
# define dictionary outside the function call:
credit_card={
'card_number': '4111111111111111',
'expiration_date': '04/2014',
'card_code': '343',
}
import authorize
authorize.Configuration.configure(
authorize.Environment.TEST,
'api_login_id',
'api_transaction_key',
)
result = authorize.Transaction.sale({'amount': 40.00,credit_card})
result.transaction_response.trans_id
it returns following error:
result = authorize.Transaction.sale({40.00,credit_card})
TypeError: unhashable type: 'dict'
Do I need to make changes in authorize.Transaction.sale() source code?
More information about the Python-list
mailing list