def _calculate_signature(self, query_params_list): query_string = urlencode_quote(query_params_list) string_to_sign = '%s\n%s\n%s\n%s' % ( self.endpoint.method, self.endpoint.host, self.endpoint.path, query_string ) return hmac_sha256(self.creds.secret_key, string_to_sign)
def sign(self, bytes, hash_type="sha256"): """Sign some bytes.""" if hash_type == "sha256": return hmac_sha256(self.secret_key, bytes) elif hash_type == "sha1": return hmac_sha1(self.secret_key, bytes) else: raise RuntimeError("Unsupported hash type: '%s'" % hash_type)
def sign(self, bytes, hash_type="sha256"): """Sign some bytes.""" if hash_type == "sha256": return hmac_sha256(self.secret_key, bytes) elif hash_type == "sha1": return hmac_sha1(self.secret_key, bytes)