My goal is to come up with a portable urllib2 solution that will be a POST form, and then redirect the user to what comes out. The POSTing part is simple:
request = urllib2.Request('https://some.site/page', data=urllib.urlencode({'key':'value'}))
response = urllib2.urlopen(request)
The grant datasets the type of POST request. Now, I suspect that all the data that I should care about comes from response.info()and response.geturl(). I have to do self.redirect(response.geturl())inside the method get(self) webapp.RequestHandler.
But what should I do with the headlines? Anything else I forgot? Code snippets are much appreciated. :)
TIA.
EDIT: Here's a naive solution that I came across. Redirects, but the remote server shows an error indicating that it does not match the previous POSTed form:
info = response.info()
for key in info:
self.response.headers[key] = info[key]
self.response.headers['Location'] = response.geturl()
self.response.set_status(302)
self.response.clear()