Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percent encoding #118

Open
emican86 opened this issue Feb 24, 2019 · 1 comment
Open

Percent encoding #118

emican86 opened this issue Feb 24, 2019 · 1 comment

Comments

@emican86
Copy link

Looking for suggestions on how to adjust percent encoding of oauth parameters.
I'm in the process of creating a new client and requests work as long as '/' is not present in some oauth parameters. Has anyone else experienced a situation like this?

I tried overwriting Client._request to manually encoding parameters which are passed into aiohttp.ClientSession next line. It will work as long as '/' character is not present.

kwargs : {'params': {'oauth_consumer_key': 'aaa', 'oauth_nonce': '4a0ff66a0ac3674e6fd2b3b236890fb05dbe8304', 'oauth_signature_method': 'HMAC-SHA1', 'oauth_timestamp': '1551030612', 'oauth_version': '1.0', 'oauth_callback': 'oob', 'oauth_token': 'qbG4My9Lpz5mc5M1afhflTrG0NwOXN%2FH8bDFig4OoEU%3D',

Result: Get request fails with status 401. session.request(method, url, **kwargs) partly decoded the oauth token ? I thought aiohttp.ClientSession does not attempt percent encoding?

OAuth: oauth1 - DEBUG - response url: https://127.0.0.1?oauth_consumer_key=aaa&oauth_nonce=4a0ff66a0ac3674e6fd2b3b236890fb05dbe8304&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1551030612&oauth_version=1.0&oauth_callback=oob&oauth_token=qbG4My9Lpz5mc5M1afhflTrG0NwOXN/H8bDFig4OoEU%3D&oauth_signature=PA2VSz5drOUBWLbfLXiuPE9bB20%3D

https://tools.ietf.org/html/rfc5849#section-3.6
https://tools.ietf.org/html/rfc3986

@jlricon
Copy link

jlricon commented Jul 24, 2020

Adding client.escape = True
may solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants