Q:

Mechanize not logging in to site properly

After spending the best part of 3 hours getting nowhere, i thought i would ask a question myself.
i am using python and mechanize's Browser. I am trying to login to my home router. i can get to the login page, fill the password field (eg br.form['password'] = 'mypassword' etc), but now i am stuck because no matter what i try, i always get sent to a page saying i am forbidden/session has timed out i am handling cookies with a cookie jar, i have handled robots, but it still doesnt love me enough to let me login.... help?
if you have any suggestions as to why i can not login successfully, please, please, please share xxx 
EDIT:
it does have javascript, but i am simulating it
**EDIT2:**

i just realized that the javascript i am simulating is for pressing the disconnect button on the previous page...... probably fix my problem if i emulate the javascript for this page ......
i am faking the user agent
i will have a look w/ wireshark xxx
ps thanks for replying so fast xx
UPDATE:
sigh. i think it may just be one of those things where you just have to say f it and move on because i am emulating the javascript it needed exactly as it is done (just checking, MD5 == hashlib.md5("...").hexdigest()?).... thanks anyway people xxx

A:

Since you have to deal with Javascript, I'd try to use WebDriver. It has Python bindings and it's not that hard to use.

