Python API后授权

Python API后授权,python,python-3.x,api,Python,Python 3.x,Api,我是python初学者,但我想从加密货币市场bitbay.net上的私人帐户获取信息数据 我在Python 3.5中的代码: import requests import json import hashlib import time hash_object = hashlib.sha512(b'public_api_xxxxxx') apihash = hash_object.hexdigest() timestamp = time.time() p = requests.pos

我是python初学者,但我想从加密货币市场bitbay.net上的私人帐户获取信息数据

我在Python 3.5中的代码:

import requests
import json
import hashlib
import time

hash_object = hashlib.sha512(b'public_api_xxxxxx')
apihash = hash_object.hexdigest()    
timestamp = time.time()

p = requests.post('https://bitbay.net/API/Trading/tradingApi.php', data={'API-Key':'public_api_xxxxxx','API-Hash':apihash,'Moment':timestamp, 'Method':'info' })
p.text
print(p)
我花了很多时间来解决这个问题,但我仍然得到:

答复[404]

非常感谢您的帮助。为了得到最好的答案,我想买一杯小啤酒:)提前谢谢你

要执行等效,您可以使用:

此外,在文档中,
API键
API散列
是标题<代码>力矩&
方法
字段在正文中是url编码的

蟒蛇2

import requests
import hashlib
import hmac
import time
import urllib

secret = "12345"
apiKey = "public_api_xxxxxx"

timestamp = int(time.time())

data = urllib.urlencode((('method', 'info'),('moment', timestamp)))

apihash = hmac.new(secret, data, hashlib.sha512).hexdigest()

res = requests.post('https://bitbay.net/API/Trading/tradingApi.php',
    headers={
    'API-Key':apiKey,
    'API-Hash' : apihash,
    'Content-Type' : 'application/x-www-form-urlencoded'
    },
    data=data
)

print(res)
print(res.text)
蟒蛇3

import requests
import hashlib
import hmac
import time
import urllib

secret = b"12345"
apiKey = "public_api_xxxxxx"

timestamp = int(time.time())

data = urllib.parse.urlencode((('method', 'info'),('moment', timestamp)))

apihash = hmac.new(secret, data.encode('utf-8'), hashlib.sha512).hexdigest()

res = requests.post('https://bitbay.net/API/Trading/tradingApi.php',
    headers={
    'API-Key':apiKey,
    'API-Hash' : apihash,
    'Content-Type' : 'application/x-www-form-urlencoded'
    },
    data=data
)

print(res)
print(res.text)

谢谢你的帮助!你是老板:)请给我你的加密货币钱包地址-我想给你买瓶啤酒:)不客气,我很高兴能帮上忙,如果你喜欢,你可以接受/投票,那就好了:)好的。谢谢:)
import requests
import hashlib
import hmac
import time
import urllib

secret = b"12345"
apiKey = "public_api_xxxxxx"

timestamp = int(time.time())

data = urllib.parse.urlencode((('method', 'info'),('moment', timestamp)))

apihash = hmac.new(secret, data.encode('utf-8'), hashlib.sha512).hexdigest()

res = requests.post('https://bitbay.net/API/Trading/tradingApi.php',
    headers={
    'API-Key':apiKey,
    'API-Hash' : apihash,
    'Content-Type' : 'application/x-www-form-urlencoded'
    },
    data=data
)

print(res)
print(res.text)