se******@spawar.navy.mil wrote:
I finally figured out how to use the wonderful module urllib to
download files.
What if web page requires you to fill out a form with login and
password first?
Is this just like any other FORM? Can login/password from a GET method
form be handled by appending something like "?login=foo,password=bar"
to URL?
Is that right way?
If by "the URL" you mean the one that was used to retrieve the page in
the first place, then the answer is "not necessarily, and rarely".
Generally you need to parse the FORM and use its "action" attribute as
the URL, plus whatever form fields are required. It might be just login
and password, but the choice of names is form-specific and there may be
other (even hidden) fields that are required. Tools such as
http://wwwsearch.sourceforge.net/mechanize/ can help you with this.
-Peter