gpt4 book ai didi

python - 如何在 Python 中进行 HMAC-SHA512 签名?

转载 作者:太空宇宙 更新时间:2023-11-03 14:47:59 25 4
gpt4 key购买 nike

<分区>

我想按照以下格式进行获取请求:

https://bittrex.com/api/v1.1/account/getbalance?apikey=API_KEY&currency=BTC

我确实有公钥和私钥。但是我发现了以下声明:

For this version, we use a standard HMAC-SHA512 signing. Append apikey and nonce to your request and calculate the HMAC hash and include it under an apisign header

我真的不知道如何正确加密我的 key 。使用普通 key 显然会返回“NONCE_NOT_PROVIDED”。我得到的一切都是这样的:

current_price = requests.get("https://bittrex.com/api/v1.1/account/getbalance?apikey=API_KEY&currency=BTC")

如何正确地签署和加密 key ?谢谢。

编辑:

当前尝试如下所示。

def getWalletSize():
APIkey = b'29i52wp4'
secret = b'10k84a9e'
s = "https://bittrex.com/api/v1.1/account/getbalance?apikey=29i52wp4&currency=BTC"
digest = hmac.new(secret, msg=s, digestmod=hashlib.sha512).digest()
current_balance = requests.get(digest)
return current_balance

但是它引发了错误Unicode-objects must be encoded before hashing

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com