HTTPSignatureAuth.verify: Rely only on request.url, not path_url
This allows broader compatibility with request objects: in addition to requests.PreparedRequest, we can now support requests.Request or any object that has the method, url, and headers attributes.pull/4/head
parent
cd28a779b1
commit
ea8d82cf0d
|
@ -74,7 +74,8 @@ class HTTPSignatureAuth(requests.auth.AuthBase):
|
|||
sts = []
|
||||
for header in headers:
|
||||
if header == "(request-target)":
|
||||
sts.append("(request-target): {} {}".format(request.method.lower(), request.path_url))
|
||||
path_url = requests.models.RequestEncodingMixin.path_url.fget(request)
|
||||
sts.append("(request-target): {} {}".format(request.method.lower(), path_url))
|
||||
else:
|
||||
if header.lower() == "host":
|
||||
value = request.headers.get("host", urlparse(request.url).hostname)
|
||||
|
|
Loading…
Reference in New Issue