-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Comma encoding in request params #794
Comments
Ehh...standards are hard. The comma (along with some other characters) is defined in RFC 3986 as a reserved character. This means the comma has defined meaning at various parts in a URL, and if it is not being used in that context it needs to be percent-encoded. That said, the query parameter doesn't give the comma any special syntax, so in query parameters we probably shouldn't be encoding it. That said, it's not entirely Requests' fault: the parameters are encoded using This isn't easy to fix though, because some web services use @kennethreitz, can you think of anyone who would have a better insight into this problem? |
If you are passing it in via |
Thanks for the quick response and clarification! |
thanks.it cleared the mist in my brain |
It seems a little inconsistent to encode the comma despite the standard allowing commas in that context, while a param set to a list is encoded like To prevent comma encoding, it's as simple as calling Obviously the default behavior of passing a list as a params dict entry value shouldn't change, but perhaps a configuration parameter could be passed to override this behavior? If either/both of those endeavors get a maintainer's blessing, I'd be happy to whip up a pull request or two. |
I'm making requests against an API which takes comma separated parameter values.
A working request looks like this:
When I pass these parameters in with
requests.get()
however, the resulting URL looks like this:I can build the URL myself, but I'm wondering if this is the intended behavior?
The text was updated successfully, but these errors were encountered: