Skip to content

Commit 5a548c4

Browse files
committed
sign_request checks if the request is an instance of PreparedRequest or fallback to the previous implementation
1 parent 1a58513 commit 5a548c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

oauth1/signer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2626
# SUCH DAMAGE.
2727
#
28-
from requests import Request
28+
from requests import PreparedRequest
2929

3030
from oauth1.oauth import OAuth
3131

@@ -37,7 +37,7 @@ def __init__(self, consumer_key, signing_key):
3737
self.signing_key = signing_key
3838

3939
def sign_request(self, uri, request):
40-
body = request.data if isinstance(request, Request) else request.body
40+
body = request.body if isinstance(request, PreparedRequest) else request.data
4141
# Generates the OAuth header for the request, adds the header to the request and returns the request object
4242
oauth_key = OAuth.get_authorization_header(uri, request.method, body, self.consumer_key,
4343
self.signing_key)

0 commit comments

Comments
 (0)