|
发表于 2021-10-23 11:56:22
|
显示全部楼层
天津市天津市
楼主这种方法该如何调用呢 求助
def order_history(contractId):
contId = str(contractId)
timestamp = str(quote(datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S')))
url = base + '/v1/order/%s/history' % contId
dataJsonStr = 'GET\n' + 'api.citex.io' + '\n' + '/v1/order/%s/history' % contId + '\n'
add_data = 'AccessKeyId=%s' % akey + '\n' + 'SignatureMethod=HmacSHA256' + '\n' + 'SignatureVersion=2' + '\n' + 'Timestamp=%s' % timestamp
added_data = add_data.split('\n')[0] + '&' + add_data.split('\n')[1] + '&' + add_data.split('\n')[2] + '&' + \
add_data.split('\n')[3]
dataJsonStr = dataJsonStr + added_data
signature = quote(createHash(dataJsonStr=dataJsonStr))
r = requests.get(url=url + '?' + added_data + '&' + 'Signature=' + signature, headers=headers)
detail = r.json()
return detail
order_history('15')
|
|