Just trying to login to a website using mechanize. When I print "br.form", I can see my credentials entered into my form. But I do not know how to actually submit the form properly.
I use "br.submit()" and attempt to verify it has proceeded to the next page by printing the br.title(), but the title appearing is for the login screen, and not the post-login screen.
import mechanize
from time import sleep
def reportDownload():
# Prompt for login credentials
print("We require your credentials.")
Username = raw_input("Please enter your username. ")
Password = raw_input("Please input your password. ").encode('base64')
URL = "https://login.xxxxxxxxx.com/"
br = mechanize.Browser()
br.open(URL)
br.select_form(nr=0)
br['username'] = Username
br['pw'] = Password.decode('base64')
print br.form
# Login
br.submit()
# print page title to confirm proper login
print br.title()
reportDownload()
This might give you a better picture of what's going on.
It would probably help in general to enable debugging in mechanize: