I have written the following python script, using python requests (http://requests.readthedocs.org/en/latest/):
import requests
payload = {\'key1\': \'value 1\
PYTHON 2.7
Override the urllib.quote_pluse with urllib.quote
The urlencoder uses urllib.quote_pluse to encode the data.
import requests
import urllib
urllib.quote_plus=urllib.quote # A fix for urlencoder to give %20
payload = {'key1': 'value 1', 'key2': 'value 2'}
headers = {'Content-Type': 'application/json;charset=UTF-8'}
param = urllib.urlencode(payload) #encodes the data
r = requests.get("http://example.com/service", params=param, headers=headers,
auth=("admin", "password"))
the output for param = urllib.urlencode(payload)
'key2=value%202&key1=value%20%201'