diff options
author | Tax <paultax@gmail.com> | 2012-10-02 13:25:47 +0200 |
---|---|---|
committer | Tax <paultax@gmail.com> | 2012-10-02 13:25:47 +0200 |
commit | 1ff9b0bd70626d0131eed530b723ac269dd99f5d (patch) | |
tree | cd797299890fc3247eea78d888f688159a7bebae /awsauth.py | |
parent | 73415743f77e499077c725016931de0d0a00933a (diff) | |
download | python-requests-aws-1ff9b0bd70626d0131eed530b723ac269dd99f5d.tar.gz |
A little shorter
Testing travis again
Diffstat (limited to 'awsauth.py')
-rw-r--r-- | awsauth.py | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -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: |