well, I am not a python programmer and maybe I am doing silly things or this is not as complex as I see but I not able to do what you mention above. I get the error, 'NoneType' object has no attribute 'read'
I have tried to follow http://code.activestate.com/recipes/146306/, with only fields (the fields of my form) but I get stack here return h.file.read() with the mentioned error. I have also tried httplib.HTTPS but there is no way to get the results I wanted. (i have also commeted errcode, errmsg, header = ..., because i got some errors) here is my code: fields = [('Ds_Merchant_Titular', Ds_Merchant_Titular),( ......... ] content_type, body = encode_multipart_formdata(fields) h = httplib.HTTPS("sis.sermepa.es",443) h.putrequest('POST', '/sis/realizarPago') h.putheader('content-type', content_type) h.putheader('content-length', str(len(body))) h.endheaders() h.send(body) #errcode, errmsg, headers = h.getreply() return h.file.read() I have also tried with this code: ...... data = urlencode(request.POST) resp, content = conn.request(u" https://sis.sermepa.es/sis/realizarPago", 'POST', data) sys.stderr.write("\n\n\n\n mikimiki ----- " + content); return HttpResponse(content) But here I get the URL of my django place in my browser instead of https://sis.sermepa.es/sis/realizarPago. I mean, all the images and resources are refered to relative paths and I not able to display the page. For sure return HttpResponse(content) is not the way as Antoni commented. could anybody clarify me anything? On Tue, Feb 17, 2009 at 7:28 PM, Antoni Aloy <antoni.a...@gmail.com> wrote: > > 2009/2/17 Miguel <migue...@gmail.com>: > > thanks karen, that is what I meant. > > So there is no way to return in my views.py an external web html with > post > > parameters ... it must be a way to do that, dont think so? > > > Yes, but you can't do it this way. > > 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<http://musi-cal.mojam.com/> > ") > >>> conn.request("POST", "/cgi-bin/query", params, headers) > >>> response = conn.getresponse() > >>> print response.status, response.reason > 200 OK > >>> data = response.read() > >>> conn.close() > > Hope it helps! > > -- > Antoni Aloy López > Blog: http://trespams.com > Site: http://apsl.net > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---