Using 'quote' instead 'quote_plus' 

Modified call to urlencode to change its default behavior. 
In place of using 'quote_plus' it uses 'quote' now.
fixes #5170

edit: for python 2 no change

Works fine in python 3 but not in python 2. 


For python 2 its behavior is intact.  

@nateprewitt ,
Hi can you review it , It has very minimal changes. 

> Thanks for the patch :)
> Do you think you could you add a simple test for that part of the code?

I have never written test earlier.
But surely can try to learn. Can you help me?


Perhaps could you try something like that (not tested, you will need to adapt):
```python
def test_params_quote_via():
    # Verifiy parameters are parsed using quote() (spaces are seen as "%20", not "+", for instance)
    params = {'sql': "project = 'foo' and name = 'bar'"}
    p = PreparedRequest()
    p.prepare(
        method='GET',
        url='https://www.example.com/',
        params=params
    )
    expected = 'https://www.example.com/?sql=project%20%3D%20%27foo%27%20and%20name%20%3D%20%27bar%27'
    assert p.url == expected
```
You could put it after that test: https://github.com/psf/requests/blob/7b565d886c852609a849e79e4ad8f3f8fa8d8c23/tests/test_requests.py#L2255

Thank you very much.
I would commit the test by   tomorrow evening (IST)
Thanks & Regards
Shiva Reddy K.
Scientist/Engineer 'SD'
Indian Institute of Remote Sensing,
Indian Space Research Organisation
Department of Space
4-Kalidas Road
Dehradun
mobile: 0135-2524126


On Tue, 28 Jan 2020 at 15:13, Mickaël Schoentgen <notifications@github.com>
wrote:

> Perhaps could you try something like that (not tested, you will need to
> adapt):
>
> def test_params_quote_via():
>     # Verifiy parameters are parsed using quote() (spaces are seen as "%20", not "+", for instance)
>     params = {'sql': "project = 'foo' and name = 'bar'"}
>     p = PreparedRequest()
>     p.prepare(
>         method='GET',
>         url='https://www.example.com/',
>         params=params
>     )
>     expected = 'https://www.example.com/?sql=project%20%3D%20%27foo%27%20and%20name%20%3D%20%27bar%27'
>     assert p.url == expected
>
> You could put it after that test:
> https://github.com/psf/requests/blob/7b565d886c852609a849e79e4ad8f3f8fa8d8c23/tests/test_requests.py#L2255
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/psf/requests/pull/5285?email_source=notifications&email_token=ABLEICBOGFSFK7FYLFEICU3Q7743ZA5CNFSM4JWN2DG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKCUZJI#issuecomment-579161253>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABLEICCVMPK6EWP2YZCDRFLQ7743ZANCNFSM4JWN2DGQ>
> .
>


Yes it seems confusing at first instance.
In  python 2  requests was not  behaving as per normal expectation of user.
But in python 3 it is possible , with least efforts. (due to change in python 3 API).

Hi @shivareddyiirs,

Thanks for the work you've put in here. If we were to change this behaviour in Requests it would need to be uniform across all versions of Python, otherwise users will inevitably stumble on it. This would also be a breaking change which means it couldn't be merged into master until we were ready for a Requests 3.0 release.

That said, the behaviour you're seeing with params is intended and documented in the [`Request` docstring](https://github.com/psf/requests/blob/master/requests/models.py#L211-L213). The params passed as dictionaries or lists of tuples will be [form-encoded](https://en.wikipedia.org/wiki/Percent-encoding#The_application/x-www-form-urlencoded_type) which uses + instead of %20. If you want to fiddle with the query string, you're still able to pass a string into the `params` argument.

I don't think we have intention to change this presently since it's easy to work around and has been operating under the same semantics since Requests' inception. Moving away from the idea of form-encoding by default would be a larger discussion for the project.

> 
> 
> Hi @shivareddyiirs,
> 
> Thanks for the work you've put in here. If we were to change this behaviour in Requests it would need to be uniform across all versions of Python, otherwise users will inevitably stumble on it. This would also be a breaking change which means it couldn't be merged into master until we were ready for a Requests 3.0 release.
> 
> That said, the behaviour you're seeing with params is intended and documented in the [`Request` docstring](https://github.com/psf/requests/blob/master/requests/models.py#L211-L213). The params passed as dictionaries or lists of tuples will be [form-encoded](https://en.wikipedia.org/wiki/Percent-encoding#The_application/x-www-form-urlencoded_type) which uses + instead of %20. If you want to fiddle with the query string, you're still able to pass a string into the `params` argument.
> 
> I don't think we have intention to change this presently since it's easy to work around and has been operating under the same semantics since Requests' inception. Moving away from the idea of form-encoding by default would be a larger discussion for the project.

Thanks,  I have made further changes , now it can work without braking the API.

Hey @shivareddyiirs,

It looks like the latest revision doesn't work for Python 2 and still has varied behaviour in the tests. I think we're going to maintain the existing behaviour and maintain the current advice to pass a string if you need non-form-encoded parameters. Thanks again for your work!

Sure.