示例#1
0
文件: client.py 项目: lud4ik/txAWS
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)