Hi all, does anybody have authenticated parts of the 796.com API working? Or maybe even actual sample code? I am trying to make a script to regularly fetch my positions and balances.
Getting an access token works fine:
In [2]: url
Out[2]: 'https://796.com/oauth/token?appid=12345×tamp=1390028823&apikey=1234f38c-5678-07a3-90ab-54cb-411f9d4c&secretkey=SECRETEDITED&sig=NGUyMTAxM2QwZmMyNjM1YzUzNWIzNmYyMjY1YzU0MmFkMmNhODI2NA%3D%3D'
In [3]: import requests
In [4]: requests.get(url).json()
Out[4]:
{u'data': {u'access_token': u'12345%7CFRiesmsE0kQQstbBkt3LhR%2BI2%2BKQzOkSdKRkvXXZxWtJ1
TrE3tQ%2BwAwH6mVYAReQ',
u'rights': u'weeklyfutures,ltcfutures,btcusd,ltcusd',
u'uid': u'123456',
u'username': u'EDITED'},
u'errno': u'0',
u'msg': u'success'}
'
# slightly edited
In [21]: requests.get(url).json()['data']['access_token']
Out[21]: u'12345%7CzaBj78CvQ5Sw.....MgW%2BBzoEewFkn71VYRAKQ'
In [22]: urllib.unquote(requests.get(url).json()['data']['access_token'])
Out[22]: u'12345|UCqzlOzgeF...........Qw3/zA9AUeg'
I suspect the last version is the correct one (unquoted). Anyway, I'm unable to figure out how to actually use these tokens, all my attempts so far has led to a singular result:
# sligthtly edited for security
In [25]: print q1
12345|Oj2EBShZ..............................................sa/x68Q+oFwiOkD4USdQ
In [26]: requests.get('
https://796.com/v1/user/get_info?%s' % q1)
Out[26]: <Response [200]>
In [27]: _.text
Out[27]: u'Access Denied!'
In [28]: requests.get('
https://796.com/v1/user/get_info?access_token=%s' % q1)
Out[28]: <Response [200]>
In [29]: _.text
Out[29]: u'Access Denied!'
Hoping for ideas!
Thanks!
UPDATE: It boils to me not understanding oauth at all. Anyways, I do receive two fields separated by a pipe in the data.access_token response object. First field is same as APP ID and the other one i guuess i the secret token. I'm trying this with python 2.7 rauth, still looking for that correct magic incantation.