Finally solved it!
Here is the working version of the send_signed_call
function, enjoy:
def send_signed_call(api_endpoint, params):
nonce = _nonce()
reqid = _reqid(nonce)
call = json.dumps({
"id" : reqid,
"nonce" : nonce,
"call" : api_endpoint,
"params" : params,
})
callByte = bytes(call, "utf-8")
sign = hmac.new(base64.b64decode(api_secret), callByte, hashlib.sha512).digest()
skey = bytes.fromhex(api_key.replace("-",""))
signedcall = skey + sign + callByte
return json.dumps({
"op" : "call",
"call" : base64.b64encode(signedcall).decode("utf-8"),
"id" : reqid,
"context" : "mtgox.com"
})
You guys have no idea how happy a panda I am right now!