[Tutor] Mod-python

Patricia G. patriciap.gu at gmail.com
Mon Jun 12 23:40:28 CEST 2006


Hi,

>
> When you say you that you want to send this data via Apache do you
> mean that the web server you are sending to is running Apache


Yes.

If you simply want to emulate a a web page with a submit button that
> sends a Post you do it with code a bit like the following
>
> import urllib, urllib2
> url = "http://www.somesite.com/somefolder/exampl1.cgi"
> dict = {}
> dict["field1"] = "value1"
> dict["field2"] = "value2"
> ...
> dict["fieldn"] = "valuen"
> urldata = urllib.urlencode(dict)
> req = urllib2.Request(url)
> req.add_header('User-agent','Mozilla/4.0 (compatible; MSIE 5.5; Windows NT
> 5.0')
> fd = urllib2.urlopen(req,urldata)
>
> Regards
> Peter Jessop



I'll try this out. Thank you!
Patricia

>
> > Hope anyone can point me to the right direction..
> > Thanks,
> > Patricia
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060612/0a0e21de/attachment.htm 


More information about the Tutor mailing list