From 5899fea2571608112b51591abf201885f6ae582f Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Mon, 26 Oct 2020 16:23:26 -0700 Subject: [PATCH] add sign_header kwarg to HTTPSignatureAuth `sign_header` was originally introduced in #15. This adds it to the requests authentication implementation. --- httpsig/requests_auth.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/httpsig/requests_auth.py b/httpsig/requests_auth.py index 8a00310..d107f9c 100644 --- a/httpsig/requests_auth.py +++ b/httpsig/requests_auth.py @@ -20,12 +20,16 @@ class HTTPSignatureAuth(requests.auth.AuthBase): `algorithm` is one of the six specified algorithms headers is a list of http headers to be included in the signing string, defaulting to "Date" alone. + `sign_header`, optional, header used to include signature. defaults to + 'authorization'. """ - def __init__(self, key_id='', secret='', algorithm=None, headers=None): + def __init__(self, key_id='', secret='', algorithm=None, headers=None, + sign_header='authorization'): headers = headers or [] self.header_signer = HeaderSigner( key_id=key_id, secret=secret, - algorithm=algorithm, headers=headers) + algorithm=algorithm, headers=headers, + sign_header=sign_header) self.uses_host = 'host' in [h.lower() for h in headers] def __call__(self, r):