Doing POST opperations from Python
Skip Montanaro
skip at mojam.com
Tue Aug 31 20:42:48 EDT 1999
>> import urllib
>> paramstring = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query",
>> paramstring)
>> print f.read()
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
out.
Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/~skip/
847-971-7098 | Python: Programming the way Guido indented...
More information about the Python-list
mailing list