S3_2.py 246 B

123456
  1. def encode(aws_secret_access_key, str, urlencode=False):
  2. b64_hmac = base64.encodestring(hmac.new(aws_secret_access_key, str, sha).digest()).strip()
  3. if urlencode:
  4. return urllib.quote_plus(b64_hmac)
  5. else:
  6. return b64_hmac