forwarding a post in python

< 1 minute read

Wanted to run some data validation on a post request, then forward that request onto a different url.
Used urllib2, although it wasn’t exactly intuitive.
In my python code, I receive an django.http Request object.
To forward the request on, I did:
and then

The part that weirded me out was the why I needed to urlencode the post. The post parameters don’t go in the url! Why would I urlencode them?
Whatever, it didn’t work unless I called ‘urllib.urlencode’ on the reqiest’s POST parameters. Weird.

Leave a Reply