From d40ca0aae53cdf42c98615bafaf684b4118f3729 Mon Sep 17 00:00:00 2001 From: Stan Mishchenko Date: Sat, 14 May 2016 20:36:24 -0400 Subject: [PATCH] Add support for files as request body --- requests_aws4auth/aws4auth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requests_aws4auth/aws4auth.py b/requests_aws4auth/aws4auth.py index 3b84cf8..e0b55ff 100644 --- a/requests_aws4auth/aws4auth.py +++ b/requests_aws4auth/aws4auth.py @@ -398,6 +398,8 @@ def __call__(self, req): # encode body and generate body hash if hasattr(req, 'body') and req.body is not None: + if hasattr(req.body, 'read'): + req.body = req.body.read() self.encode_body(req) content_hash = hashlib.sha256(req.body) elif hasattr(req, 'content') and req.content is not None: