Get parameters are being double encoded

parameters are being double encoded.  I have the following code:

url = 'http://example.com'
queryParameters = {"MenuRequest": '{"language":"en-us","storeName":"R10501","datetime":"00:00:00","tenant":"store1"}'}

and I pass it in like such:
response = requests.get(url, params = queryParameters, verify=False)

the result is this:
http://example.com/?MenuRequest=%257B%2522language%2522%253A%2522en-us%2522%252C%2522storeName%2522%253A%2522R10501%2522%252C%2522datetime%2522%253A%252200%253A00%253A00%2522%252C%2522tenant%2522%253A%2522store1%2522%257D

it should be this:
http://example.com/?MenuRequest=%7B%22language%22%3A%22en-us%22%2C%22storeName%22%3A%22R10501%22%2C%22datetime%22%3A%2200%3A00%3A00%22%2C%22tenant%22%3A%22store1%22%7D

The problem is that that the parameters are being double encoded.  


``` pycon
~ python
Python 2.7.7 (default, Jun  2 2014, 18:55:26)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> queryParameters = {"MenuRequest": '{"language":"en-us","storeName":"R10501","datetime":"00:00:00","tenant":"store1"}'}
>>> import requests
>>> r = requests.get('https://httpbin.org/get', params=queryParameters)
>>> r.url
u'https://httpbin.org/get?MenuRequest=%7B%22language%22%3A%22en-us%22%2C%22storeName%22%3A%22R10501%22%2C%22datetime%22%3A%2200%3A00%3A00%22%2C%22tenant%22%3A%22store1%22%7D'
>>> requests.__version__
'2.3.0'
```

I'm not seeing the same behaviour. What version of requests are you using?


I'm using 2.3.0.  Upon further investigation it appears that the behavior I described above is only occurring for me when I am running code from the eclipse pydev (on windows).  It works correctly when I run it directly from the commandline.


I'm going to close this issue as it's not a issue with the requests library and likely an issue with my dev environment setup or potentially an issue with py-dev plugin.


I thought I'd fixed the issue, but I figured it out.  Here's how to reproduce the double percent encoding issue:

url = 'http://www.pizzahut.ca/mobilem8-menu-service/rest/menuservice/menu?'
queryParameters = {"MenuRequest": '{"language":"en-us","storeName":"R10501","datetime":"00:00:00","tenant":"store1"}'}
response = requests.get(url, params = queryParameters, verify=False)
print response.url

If you change the url to https instead of http, it will work as expected and not percent encode twice.


This is not our fault, it's Pizza Hut's:

``` python
>>> url = 'http://www.pizzahut.ca/mobilem8-menu-service/rest/menuservice/menu?'
>>> queryParameters = {"MenuRequest": '{"language":"en-us","storeName":"R10501","datetime":"00:00:00","tenant":"store1"}'}
>>> r = requests.get(url, params = queryParameters, verify=False)
>>> r.history
[<Response [301]>]
>>> r.history[0].headers['location']
'https://www.pizzahut.ca/mobilem8-menu-service/rest/menuservice/menu?MenuRequest=%257B%2522language%2522%253A%2522en-us%2522%252C%2522storeName%2522%253A%2522R10501%2522%252C%2522datetime%2522%253A%252200%253A00%253A00%2522%252C%2522tenant%2522%253A%2522store1%2522%257D'
```

We're being redirected to that URL, so unsurprisingly we're going there. =)


The issue is not with the redirection.  It's the fact that the when it's redirected, requests is encoding the query parameters a second time.  The url you list at the end:

'https://www.pizzahut.ca/mobilem8-menu-service/rest/menuservice/menu?MenuRequest=%257B%2522language%2522%253A%2522en-us%2522%252C%2522storeName%2522%253A%2522R10501%2522%252C%2522datetime%2522%253A%252200%253A00%253A00%2522%252C%2522tenant%2522%253A%2522store1%2522%257D'

should be

 'https://www.pizzahut.ca/mobilem8-menu-service/rest/menuservice/menu?MenuRequest=%7B%22language%22%3A%22en-us%22%2C%22storeName%22%3A%22R10501%22%2C%22datetime%22%3A%2200%3A00%3A00%22%2C%22tenant%22%3A%22store1%22%7D'


Let's walk through an even more explicit version of the code I posted above. I invite you to follow along in your command shell. First, do some set up:

``` python
>>> import requests
>>> url = 'http://www.pizzahut.ca/mobilem8-menu-service/rest/menuservice/menu?'
>>> queryParameters = {"MenuRequest": '{"language":"en-us","storeName":"R10501","datetime":"00:00:00","tenant":"store1"}'}
```

With that set up done, let's make the request. We'll prevent requests from following any redirects to make sure that we don't mess with the response.

``` python
>>> r = requests.get(url, params=queryParameters, verify=False, allow_redirects=False)
```

Check the status code and you'll see its a 301 redirect.

``` python
>>> r.status_code
301
```

Confirm that the URL requests sent to was _not_ double encoded:

``` python
>>> r.url
u'http://www.pizzahut.ca/mobilem8-menu-service/rest/menuservice/menu?MenuRequest=%7B%22language%22%3A%22en-us%22%2C%22storeName%22%3A%22R10501%22%2C%22datetime%22%3A%2200%3A00%3A00%22%2C%22tenant%22%3A%22store1%22%7D'
```

As you can see, it's not, it's correctly single encoded. Let's check the URL that Pizza Hut redirected us to, which can be found in the `Location` header:

``` python
>>> r.headers['location']
'https://www.pizzahut.ca/mobilem8-menu-service/rest/menuservice/menu?MenuRequest=%257B%2522language%2522%253A%2522en-us%2522%252C%2522storeName%2522%253A%2522R10501%2522%252C%2522datetime%2522%253A%252200%253A00%253A00%2522%252C%2522tenant%2522%253A%2522store1%2522%257D'
```

_That_ has been double encoded. This is emphatically not our fault. And just to put the final nail in this coffin, here is a Wireshark packet capture demonstrating that requests has not molested that header in any way:

![headers](https://cloud.githubusercontent.com/assets/1382556/3554896/63c50ae0-0911-11e4-9620-7036fc338a48.png)