Migrate to JSON response
This commit is contained in:
parent
135fc1044c
commit
62f0f02fa7
|
@ -93,7 +93,8 @@ def bulk_buy(buycommands, user_name):
|
||||||
'Content-Length':len(data)
|
'Content-Length':len(data)
|
||||||
}
|
}
|
||||||
content = _request('buyable/item/bulkbuy/', data, 'POST', headers=headers)
|
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)
|
raise ValueError('Server says "%s"' % content)
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +118,8 @@ def deposit(amount, transaction_type, user_name):
|
||||||
|
|
||||||
content = _request('account/transactions/transact/',
|
content = _request('account/transactions/transact/',
|
||||||
{'user':user_name, 'amount':amount, 'type':transaction_type}, method='POST')
|
{'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)
|
raise ValueError('Server says "%s"' % content)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue