Posting CGI

Fredrik Lundh effbot at telia.com
Sun Apr 23 12:31:37 EDT 2000


Z 3 Penguin <z3penguin at penguinpowered.com> wrote:
> How would I go about submiting a CGI post form in python?  (This sounds
like
> it should be simple, but I can't figure it out :-) Thanks.

http://www.python.org/doc/current/lib/module-urllib.html

    import urllib

    request = urllib.urlencode({
        "name": "effbot",
        "email": "effbot at telia.com"
    })

    fp = urllib.urlopen("http://www.spam.egg", request)

    response = fp.read()

</F>

<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list