Using Mechanize to Fill Out a Form

K

KDawg44

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
 
K

KDawg44

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:
#!/usr/bin/python



import urllib

import urllib2

import mechanize

baseURL = 'https://login.yahoo.com/'
br = mechanize.Browser()
br.set_handle_robots(False)
br.addheaders = [('User-Agent', 'Firefox')]
#try:
br.open(baseURL)


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

Traceback (most recent call last):
File "FantasyHockeyLoginAndGetTeam.py", line 14, in <module>
br.open(baseURL)
File "build/bdist.linux-i686/egg/mechanize/_mechanize.py", line 209,
in open
File "build/bdist.linux-i686/egg/mechanize/_mechanize.py", line 236,
in _mech_open
File "build/bdist.linux-i686/egg/mechanize/_opener.py", line 202, in
open
File "build/bdist.linux-i686/egg/mechanize/_http.py", line 578, in
http_response
KeyboardInterrupt


Thanks for any advice.

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top