I am trying to do some automation in a Python script, and I ran into a problem. I am trying to do a POST on a server.
url = 'http://www.example.com' params = {'arg0': 'value', 'arg1': '+value'} f = urllib.urlopen(url, urllib.urlencode(params)) print f.read()
I did a proxy capture of the equivalent browser operation where the second arg, arg1 is passed as +value , however when I do this with Python, + changes to %2B , i.e.
Line-based text data: application/x-www-form-urlencoded arg0=value&arg1=%2Bvalue
when it should be:
Line-based text data: application/x-www-form-urlencoded arg0=value&arg1=+value
I also used the Requests module and it seems to have done the same.
url = 'http://www.example.com' params = {'arg0': 'value', 'arg1': '+value'} f = requests.post(url, params)
Google is not your friend when you have a "+" problem, as it seems to be a trick for everything else.
source share