GET and POST

franck opo at opo.com
Thu Sep 11 11:03:44 EDT 2003


i know how to do a GET.
:) i have this example.
my contact tell my i must do a get AND a post :/

GET to fuse param et POST for the others.

dont know how do that.

"Jeremy Jones" <zanesdad at bellsouth.net> a écrit dans le message news:
mailman.1063289827.17272.python-list at python.org...
> * franck (opo at opo.com) wrote:
> > HI,
> >
> > this is my code
> > params = {}
> >
> > params['fuseaction'] = '*****';
> > params['user'] = '***';
> > params['password'] = '**********';
> > params['num_card'] = '******';
> > params['date_of_birth'] = '****';
> >
> > params = urllib.urlencode(params)
> > f = urllib.urlopen("http://bidule.com",params)
>
>
> According to the urllib documentation (I've never used urllib, only
> httplib), all you have to do is change:
>
> f = urllib.urlopen("http://bidule.com",params)
> to
> f = urllib.urlopen("http://bidule.com?%s" % params)
>
> Here is the example from the documentation for a GET (found at
> http://www.python.org/doc/current/lib/node415.html):
>
> >>> import urllib
> >>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
> >>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query?%s" %
params)
> >>> print f.read()
>
> I haven't whether this works or not, so I take no responsibility for any
> damage caused by this code ;-)
>
> Jeremy Jones
>






More information about the Python-list mailing list