summaryrefslogtreecommitdiff
path: root/awsauth.py
diff options
context:
space:
mode:
authorTax <paultax@gmail.com>2012-10-02 13:25:47 +0200
committerTax <paultax@gmail.com>2012-10-02 13:25:47 +0200
commit1ff9b0bd70626d0131eed530b723ac269dd99f5d (patch)
treecd797299890fc3247eea78d888f688159a7bebae /awsauth.py
parent73415743f77e499077c725016931de0d0a00933a (diff)
downloadpython-requests-aws-1ff9b0bd70626d0131eed530b723ac269dd99f5d.tar.gz
A little shorter
Testing travis again
Diffstat (limited to 'awsauth.py')
-rw-r--r--awsauth.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/awsauth.py b/awsauth.py
index 8ab5e5f..3d69bfc 100644
--- a/awsauth.py
+++ b/awsauth.py
@@ -54,21 +54,13 @@ class S3Auth(AuthBase):
# remove last dot
bucket = bucket[:-1]
- interesting_headers = {}
- ok_keys = ['content-md5', 'content-type', 'date']
+ interesting_headers = {'content-md5':'', 'content-type':'', 'date':''}
for key in headers:
lk = key.lower()
- if headers[key] is not None and (lk in ok_keys or lk.startswith('x-amz-')):
+ if headers[key] and (lk in interesting_headers.keys() or lk.startswith('x-amz-')):
interesting_headers[lk] = headers[key].strip()
- # these keys get empty strings if they don't exist
- if not interesting_headers.has_key('content-type'):
- interesting_headers['content-type'] = ''
-
- if not interesting_headers.has_key('content-md5'):
- interesting_headers['content-md5'] = ''
-
# If x-amz-date is used it supersedes the date header.
if interesting_headers.has_key('x-amz-date'):
interesting_headers['date'] = ''
@@ -76,7 +68,6 @@ class S3Auth(AuthBase):
buf = '%s\n' % method
for key in sorted(interesting_headers.keys()):
val = interesting_headers[key]
-
if key.startswith('x-amz-'):
buf += '%s:%s\n' % (key, val)
else: