auths.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:acacia_main 作者: AcaciaTrading 项目源码 文件源码
def __call__(self, r):
        r.headers["Content-type"] = "application/x-www-form-urlencoded"
        r.headers["API-Key"] = self.key.replace(" ", "+")

        urlpath = '/0/private/' + self.method

        postdata = urllib.urlencode(self.params)
        #print "params:", self.params
        #print "nonce:", self.params["nonce"]
        message = urlpath + hashlib.sha256(str(self.params["nonce"]) + postdata).digest()
        #print message
        signature = hmac.new(base64.b64decode(self.secret.replace(" ", "+")), message, hashlib.sha512)
        r.headers["API-Sign"] = base64.b64encode(signature.digest())

        #print r.headers
        return r
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号