Migrate to JSON response

This commit is contained in:
Sebastian Pipping 2012-01-31 01:48:53 +01:00
parent 135fc1044c
commit 62f0f02fa7
1 changed files with 4 additions and 2 deletions

View File

@ -93,7 +93,8 @@ def bulk_buy(buycommands, user_name):
'Content-Length':len(data)
}
content = _request('buyable/item/bulkbuy/', data, 'POST', headers=headers)
if content != 'Created':
d = json.loads(content)
if not d['success']:
raise ValueError('Server says "%s"' % content)
@ -117,7 +118,8 @@ def deposit(amount, transaction_type, user_name):
content = _request('account/transactions/transact/',
{'user':user_name, 'amount':amount, 'type':transaction_type}, method='POST')
if content != 'OK':
d = json.loads(content)
if not d['success']:
raise ValueError('Server says "%s"' % content)