After a post you should use a HttpResponseRedirect(url). If you need
to have access to the post parameters an option is to save them in a
session, or encode them in the url itslef.
Hope it helps!
--
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net
params = urllib.urlencode({"Ds_Merchant_Titular": Ds_Merchant_Titular, "Ds_Merchant_MerchantCode": Ds_Merchant_MerchantCode})
#f= urllib2.urlopen("https://sis.sermepa.es/sis/realizarPago",params)
return f -> it doesnt workd
# return HttpResponseRedirect("https://sis.sermepa.es/sis/realizarPago",params) --> it doesn't work
Just check for httplib and httplib2.
http://code.activestate.com/recipes/146306/
or from Python documentation in http://docs.python.org/library/httplib.html
>>> import httplib, urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> headers = {"Content-type": "application/x-www-form-urlencoded",
... "Accept": "text/plain"}
>>> conn = httplib.HTTPConnection("musi-cal.mojam.com:80")
>>> conn.request("POST", "/cgi-bin/query", params, headers)
>>> response = conn.getresponse()
>>> print response.status, response.reason
200 OK
>>> data = response.read()
>>> conn.close()
So you need to act like a browser would. Submit the necessary
authentication form variables, save the returned cookie and send it on
subsequent requests.
Not sure how this is related ot the original question in the thread,
though, which was about redirecting what the user's browser retrieves,
not retrieving web pages inside Python scripts.
Regards,
Malcolm