You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importrequests, oauth_hookhook=oauth_hook.OAuthHook(
consumer_key='abcde',
consumer_secret='fegdslaje',
)
c=requests.session(hooks={'pre_request': hook})
url='http://localhost:8888/utils/haha'r=c.get(url, params={
'limit': 3,
})
printr, 'using params'printr.urlprintr.request.urlprintr.request.full_url# prints the following# <Response [404]> using params# http://localhost:8888/utils/haha?oauth_nonce=28493927&oauth_timestamp=1349201520&oauth_consumer_key=abcde&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&limit=3&oauth_signature=wA4HFWbSNGBuaafDIAznbe0pI7E%3D&limit=3# http://localhost:8888/utils/haha?oauth_nonce=28493927&oauth_timestamp=1349201520&oauth_consumer_key=abcde&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&limit=3&oauth_signature=wA4HFWbSNGBuaafDIAznbe0pI7E%3D# http://localhost:8888/utils/haha?oauth_nonce=28493927&oauth_timestamp=1349201520&oauth_consumer_key=abcde&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&limit=3&oauth_signature=wA4HFWbSNGBuaafDIAznbe0pI7E%3D&limit=3r=c.get(url, data={
'limit': 3,
})
printr, 'using data'printr.url#, r.request.urlprintr.request.urlprintr.request.full_url# prints the following# <Response [404]> using data# http://localhost:8888/utils/haha?oauth_nonce=28493927&oauth_timestamp=1349201520&oauth_consumer_key=abcde&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&limit=3&oauth_signature=wA4HFWbSNGBuaafDIAznbe0pI7E%3D# http://localhost:8888/utils/haha?oauth_nonce=28493927&oauth_timestamp=1349201520&oauth_consumer_key=abcde&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&limit=3&oauth_signature=wA4HFWbSNGBuaafDIAznbe0pI7E%3D# http://localhost:8888/utils/haha?oauth_nonce=28493927&oauth_timestamp=1349201520&oauth_consumer_key=abcde&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&limit=3&oauth_signature=wA4HFWbSNGBuaafDIAznbe0pI7E%3D
When using params argument together with requests.get, the limit parameter gets duplicated in the final url of the get request, resulting in an invalid signature as well as incorrect argument (limit now = [3,3] rather than just [3]).
The text was updated successfully, but these errors were encountered:
See sample code below
When using
params
argument together withrequests.get
, thelimit
parameter gets duplicated in the final url of the get request, resulting in an invalid signature as well as incorrect argument (limit now = [3,3] rather than just [3]).The text was updated successfully, but these errors were encountered: