Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit f92a4aa

Browse files
author
David Sutton
committed
Sign headers would update the dictionary in place
Changed so that it calls dict.update correctly from the returned auth dict
1 parent ef35fb3 commit f92a4aa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

http_signature/requests_auth.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ def __init__(self, key_id='', secret='', algorithm='rsa-sha256',
1818
headers=None, allow_agent=False):
1919
headers = headers or []
2020
self.header_signer = HeaderSigner(key_id=key_id, secret=secret,
21-
algorithm=algorithm, headers=headers, allow_agent=allow_agent)
21+
algorithm=algorithm, headers=headers)
2222
self.uses_host = 'host' in [h.lower() for h in headers]
2323

2424
def __call__(self, r):
25-
self.header_signer.sign_headers(
25+
headers = self.header_signer.sign_headers(
2626
r.headers,
2727
# 'Host' header unavailable in request object at this point
2828
# if 'host' header is needed, extract it from the url
2929
host=urlparse(r.url).netloc if self.uses_host else None,
3030
method=r.method,
3131
path=r.path_url,
3232
http_version='1.1')
33+
r.headers.update(headers)
3334
return r

0 commit comments

Comments
 (0)