I'm stuck trying to get mechanize working as part of a larger project I'm working on.
I'm trying to logon to the following website which I am registered at (but not as "bob" as below obviously):
I think I've managed to select the correct form (?) but I'm getting a must assign string error from the mechanize module.
Can anyone help me out? I need to read the resulting page into a string once I've successfully logged in.
Thanks :)
#!/usr/bin/python
#Designed to log into morningstar portfolio
from mechanize import Browser #no need to import urllib2 as mechanize does this
urllink = 'http://www.morningstar.co.uk/uk/membership/signup.aspx?loginType=1&lastvisit=%2fuk%2fportfoliomanager%2fportfolio.aspx%3fSite%3duk%26lang%3den-GB'
br = Browser()
br.open(urllink)
#for form in br.forms():
# print form
br.select_form(name='aspnetForm')
br["ctl00$MainContent$UserName"] = ["bob"]
br["ctl00$MainContent$Password"] = ["secret123"]
response = br.submit()
print br.read()