urllib2 problem, data param not working? : DISREGARD
Gabriel Rossetti
gabriel.rossetti at arimaz.com
Wed Apr 1 03:28:09 EDT 2009
Gabriel Rossetti wrote:
> Hello everyone,
>
> I am having a problem with urllib2, when I do this :
>
> post = urllib.urlencode(post)
> request = urllib2.Request(url, post)
> response = urllib2.urlopen(request)
>
> or this :
>
> post = urllib.urlencode(post)
> response = urllib2.urlopen(url, post)
>
> or this :
>
> post = urllib.urlencode(post)
> request = urllib2.Request(url)
> response = urllib2.urlopen(request, post)
>
> it doesn't work, it's like if the post params weren't added, and if I
> do this :
>
> post = urllib.urlencode(post)
> request = url + '?' + post
> response = urllib2.urlopen(request)
>
> it works as expected, can anyone explain what is going on? I know that
> if I don't add the data ('post' in my case) param it uses an HTTP GET,
> could that be why it works when I add them manually?
>
> Thank you,
> Gabriel
> --
>
Please disregard this msg, I didn't intend to send it, I figured out
what was wrong, it was an HTTP GET/POST problem as I suspected.
Gabriel
More information about the Python-list
mailing list