Question about urllib and posting to an external script

alex23 wuwei23 at gmail.com
Wed Sep 6 01:20:39 EDT 2006


evanpmeth at gmail.com wrote:
> all i want to do is post this form:
> HTML Code:
>
> <form method='POST' enctype='multipart/form-data'
> action='http://login.myspace.com/index.cfm?fuseaction=login.process&amp'>
> <input type="text" name="email" > <input type="password"
> name="password" > <input type="submit" value="Login"/>

Heya,

It might help to use one of the higher-level abstractions for dealing
with the web. twill (http://twill.idyll.org/) provides a simple
language for scripting web-based interactions.

The example they provide should be useable as a basis for what you
want:
++++
setlocal username <your username>
setlocal password <your password>

go http://www.slashdot.org/
formvalue 1 unickname $username
formvalue 1 upasswd $password
submit

code 200     # make sure form submission is correct!
++++

I _think_ twill is based on top of mechanize
(http://wwwsearch.sourceforge.net/mechanize/) which may be of use to
you if twill obscures or hides functionality you need.

Hope this helps.

-alex23




More information about the Python-list mailing list