aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2017-12-29 00:13:23 +0100
committerRemita Amine <remitamine@gmail.com>2017-12-29 00:13:40 +0100
commit84f085d4bdb66ee025fb337bcd571eab7469da97 (patch)
tree13711ac13190b1c357184ce04795e6fb98e8fdde
parenta491fd0c6f5abd68bae128cacbcc9926a017cee3 (diff)
downloadyoutube-dl-84f085d4bdb66ee025fb337bcd571eab7469da97.zip
youtube-dl-84f085d4bdb66ee025fb337bcd571eab7469da97.tar.gz
youtube-dl-84f085d4bdb66ee025fb337bcd571eab7469da97.tar.bz2
[aws] fix canonical/signed headers generation in python 2(closes #15102)
-rw-r--r--youtube_dl/extractor/aws.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/youtube_dl/extractor/aws.py b/youtube_dl/extractor/aws.py
index 670abce..dccfeaf 100644
--- a/youtube_dl/extractor/aws.py
+++ b/youtube_dl/extractor/aws.py
@@ -21,11 +21,11 @@ class AWSIE(InfoExtractor):
'Accept': 'application/json',
'Host': self._AWS_PROXY_HOST,
'X-Amz-Date': amz_date,
+ 'X-Api-Key': self._AWS_API_KEY
}
session_token = aws_dict.get('session_token')
if session_token:
headers['X-Amz-Security-Token'] = session_token
- headers['X-Api-Key'] = self._AWS_API_KEY
def aws_hash(s):
return hashlib.sha256(s.encode('utf-8')).hexdigest()
@@ -33,9 +33,9 @@ class AWSIE(InfoExtractor):
# Task 1: http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
canonical_querystring = compat_urllib_parse_urlencode(query)
canonical_headers = ''
- for header_name, header_value in headers.items():
+ for header_name, header_value in sorted(headers.items()):
canonical_headers += '%s:%s\n' % (header_name.lower(), header_value)
- signed_headers = ';'.join([header.lower() for header in headers.keys()])
+ signed_headers = ';'.join([header.lower() for header in sorted(headers.keys())])
canonical_request = '\n'.join([
'GET',
aws_dict['uri'],