Doing POST opperations from Python

Skip Montanaro skip at
Tue Aug 31 20:42:48 EDT 1999

    >> import urllib
    >> paramstring = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
    >> f = urllib.urlopen("",
    >> paramstring)
    >> print

    Aahz> I'm not positive, but I believe this appends paramstring to the URL
    Aahz> (through GET) instead of using POST.

Nope.  Check the urllib docs and try the above code.  It accesses my query
cgi script.  Check the REQUEST_METHOD environment variable the script spits

Skip Montanaro |
skip at |
847-971-7098   | Python: Programming the way Guido indented...

More information about the Python-list mailing list