aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason2009-12-18 12:07:58 -0700
committerjason2009-12-18 12:07:58 -0700
commitf5f678a8cd51d434c55efdaecaaddf2b32f25bb1 (patch)
tree0ceef9dc30e538a3ad8fffcd7833ff1b6a127aa6
parentf8c6036648d91abe1c3d07256c2690e56fdff8cd (diff)
downloadamazons3-py-f5f678a8cd51d434c55efdaecaaddf2b32f25bb1.tar.gz
amazons3-py-f5f678a8cd51d434c55efdaecaaddf2b32f25bb1.zip
Fixed the sha warning
-rw-r--r--S3.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/S3.py b/S3.py
index 37682f3..2456732 100644
--- a/S3.py
+++ b/S3.py
@@ -13,7 +13,7 @@ import base64
13import hmac 13import hmac
14import httplib 14import httplib
15import re 15import re
16import sha 16from hashlib import sha1
17import sys 17import sys
18import time 18import time
19import urllib 19import urllib
@@ -81,7 +81,7 @@ def canonical_string(method, bucket="", key="", query_args={}, headers={}, expir
81# computes the base64'ed hmac-sha hash of the canonical string and the secret 81# computes the base64'ed hmac-sha hash of the canonical string and the secret
82# access key, optionally urlencoding the result 82# access key, optionally urlencoding the result
83def encode(aws_secret_access_key, str, urlencode=False): 83def encode(aws_secret_access_key, str, urlencode=False):
84 b64_hmac = base64.encodestring(hmac.new(aws_secret_access_key, str, sha).digest()).strip() 84 b64_hmac = base64.encodestring(hmac.new(aws_secret_access_key, str, sha1).digest()).strip()
85 if urlencode: 85 if urlencode:
86 return urllib.quote_plus(b64_hmac) 86 return urllib.quote_plus(b64_hmac)
87 else: 87 else:
@@ -268,7 +268,7 @@ class AWSAuthConnection:
268 else: 268 else:
269 connection = httplib.HTTPConnection(host) 269 connection = httplib.HTTPConnection(host)
270 270
271 final_headers = merge_meta(headers, metadata); 271 final_headers = merge_meta(headers, metadata)
272 # add auth header 272 # add auth header
273 self._add_aws_auth_header(final_headers, method, bucket, key, query_args) 273 self._add_aws_auth_header(final_headers, method, bucket, key, query_args)
274 274
@@ -284,10 +284,12 @@ class AWSAuthConnection:
284 resp.read() 284 resp.read()
285 scheme, host, path, params, query, fragment \ 285 scheme, host, path, params, query, fragment \
286 = urlparse.urlparse(location) 286 = urlparse.urlparse(location)
287 if scheme == "http": is_secure = True 287 if scheme == "http":
288 is_secure = True
288 elif scheme == "https": is_secure = False 289 elif scheme == "https": is_secure = False
289 else: raise invalidURL("Not http/https: " + location) 290 else: raise invalidURL("Not http/https: " + location)
290 if query: path += "?" + query 291 if query:
292 path += "?" + query
291 # retry with redirect 293 # retry with redirect
292 294
293 def _add_aws_auth_header(self, headers, method, bucket, key, query_args): 295 def _add_aws_auth_header(self, headers, method, bucket, key, query_args):