Using Mechanize to Fill Out a Form

KDawg44 KDawg44 at
Tue Dec 16 22:26:56 CET 2008

On Dec 16, 3:44 pm, KDawg44 <KDaw... at> wrote:
> Hi,
> I am trying to use the Mechanize module to browse to a site, fill out
> a form, and login.  However, it hangs on the opening of the URL.  The
> URL is https, will this cause the open from mechanize to fail?
> Thanks.
> Kevin

Apparently, the HTTPS does not matter, but it is still hanging on the
open(URL).  I am trying to login to Yahoo!.

Code below:

import urllib

import urllib2

import mechanize

baseURL = ''
br = mechanize.Browser()
br.addheaders = [('User-Agent', 'Firefox')]

It just hangs until I kill it.  When I kill it, it gives me the
following traceback:

Traceback (most recent call last):
  File "", line 14, in <module>
  File "build/bdist.linux-i686/egg/mechanize/", line 209,
in open
  File "build/bdist.linux-i686/egg/mechanize/", line 236,
in _mech_open
  File "build/bdist.linux-i686/egg/mechanize/", line 202, in
  File "build/bdist.linux-i686/egg/mechanize/", line 578, in

Thanks for any advice.


More information about the Python-list mailing list