I am using mechanize ( http://wwwsearch.sourceforge.net/mechanize/ ) to login to www.coinotron.com, but the execution hangs when I do br.submit()
import mechanize
...
br = mechanize.Browser()
br.open("https://coinotron.com/app?action=logon")
form = br.select_form(nr=0)
br.form["name"] = "myusername"
br.form["password"] = "mypassword"
reponse = br.submit() # HERE THE EXECUTION HANGS!
If I comment the password line then the scripts executes ok, but of course it does not login.
Found a workaround, although I don't completely understand why it works. But it think br.submit() was sleeping due to HTTPRefreshProcessor.honor_time = True and HTTPRefreshProcessor.max_time having a big value. So I added following line just after br = mechanize.Browser()
:
br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1, honor_time=True)
Following pages helped me out, although not directly related to my problem: Mechanize in Python - Redirect is not working after submit
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.