How to parse blank to %20, not + ?

If http param contains blank, how to parse blank to %20, not + ?
```
import requests

param = {
    "sql": "project = 'foo' and name = 'bar'"
}

res = requests.get(
    url='http://xxxx',
    params=param
)

print(res.url)
# actual    http://xxxx/?sql=project+%3D+%27foo%27+and+name+%3D+%27bar%27
# expect    http://xxxx/?sql=project%20%3D%20%27foo%27%20and%20name%20%3D%20%27bar%27

```

A quick dirty way to achieve that :
```
for x in param:
     param[x] = param[x].replace(" ","%20")
```

'+' or '%20', It shouldn't be an issue for you anyways


As far as I can work out, requests uses [urllib.parse.urlencode](https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode).

> By default, quote_plus() is used to quote the values, which means spaces are quoted as a '+' character and ‘/’ characters are encoded as %2F, which follows the standard for GET requests (application/x-www-form-urlencoded).

There seems to be a way to pass a "quote_via" parameter to the urlencode inside urllib, but that does not seem to be implemented in the requests library.

Can you explain why you would need this, as I have difficulty finding a reason for the request.

> 
> 
> As far as I can work out, requests uses [urllib.parse.urlencode](https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode).
> 
> > By default, quote_plus() is used to quote the values, which means spaces are quoted as a '+' character and ‘/’ characters are encoded as %2F, which follows the standard for GET requests (application/x-www-form-urlencoded).
> 
> There seems to be a way to pass a "quote_via" parameter to the urlencode inside urllib, but that does not seem to be implemented in the requests library.
> 
> Can you explain why you would need this, as I have difficulty finding a reason for the request.

I am also having this issue. 
I am using requests library to send SQL query as parameter to RASDAMAN server. It does not support '+'.
I believe giving an option to the user or changing the default behavior by setting 'quote_via' parameter with 'quote' can solve this issue

> 
> 
> As far as I can work out, requests uses [urllib.parse.urlencode](https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode).
> 
> > By default, quote_plus() is used to quote the values, which means spaces are quoted as a '+' character and ‘/’ characters are encoded as %2F, which follows the standard for GET requests (application/x-www-form-urlencoded).
> 
> There seems to be a way to pass a "quote_via" parameter to the urlencode inside urllib, but that does not seem to be implemented in the requests library.
> 
> Can you explain why you would need this, as I have difficulty finding a reason for the request.

@epenet , Hi
I have made a PR #5285 , which uses 'quote' instead if 'quote_plus' in python 3. 
Waiting for someone with write access to review the PR.

 

So [according to the spec](https://stackoverflow.com/a/31300627/247482), apparently using the following characters is valid:

    / ? : @ - . _ ~ ! $ & ' ( ) * + , ; =

`&` and `=` of course have special meaning.

Would be nice if we could control the `quote_via` and `safe` parameters used in `requests`’ call of `urlencode`

We just want to leave `*` as unquoted but requests can not pass the `safe` param for `quote_plus`.

[When should an asterisk be encoded in an HTTP URL?](https://stackoverflow.com/questions/25085992/when-should-an-asterisk-be-encoded-in-an-http-url)

Once again, as has been stated several times, if you know you need special treatment of certain characters, you must encode the URL yourself