我想做一个基本的身份验证API调用他们的新的V2 API和得到一个无效的API密钥错误返回。bitfinex api v2错误,无效的密钥
我重新发布了api密钥只是为了验证,同样的错误。
from time import time
import urllib.request
import urllib.parse
import hashlib
import hmac
APIkey = b'myapikeyyouarenotsupposedtosee'
secret = b'myceeeeecretkeyyyy'
url = 'https://api.bitfinex.com/v2/auth/r/wallets'
payload = {
#'request':'/auth/r/wallets',
'nonce': int(time() * 1000),
}
paybytes = urllib.parse.urlencode(payload).encode('utf8')
print(paybytes)
sign = hmac.new(secret, paybytes, hashlib.sha512).hexdigest()
print(sign)
headers = {
'Key': APIkey,
'Sign': sign
}
req = urllib.request.Request(url, headers=headers, data=paybytes)
with urllib.request.urlopen(req) as response:
the_page = response.read()
print(the_page)
如何为bitfinex对新的v2 API进行身份验证的API调用?
如果你需要它的PHP或者想用PHP进行比较:https://stackoverflow.com/a/46851626/2635490 – Phil