I'm trying to learn the basics of the mechanize module and i'm very very new to programming.
Does anyone know of some good places to learn the very basics, say with some examples as well?
I found this off of a person's blog
This looks like what i think I want to do. that is sign into a web site.
However, does the site need to be set up such that 'LOGIN' is specified just like that in the source code?
when i tried it i get this error:
>>> browser.select_ form('LOGIN')
Traceback (most recent call last):
File "<interacti ve input>", line 1, in <module>
File "C:\Python25\li b\site-packages\mechan ize\_mechanize. py", line 510, in select_form
raise FormNotFoundErr or("no form matching "+descripti on)
FormNotFoundErr or: no form matching name 'LOGIN'
thanks
Does anyone know of some good places to learn the very basics, say with some examples as well?
I found this off of a person's blog
Code:
import re from mechanize import Browser username = "yourusername" password = "yourpassword" browser = Browser() url = "http://www.deviantrealms.com/index.php?act=Login&CODE=00" browser.open(url) browser.select_form('LOGIN') browser['UserName'] = username browser['PassWord'] = password response = browser.submit() response = browser.follow_link(url_regex=r"\s*Top200-L2.php") browser.back() response = browser.follow_link(url_regex=r"\s*Top100-L2.php")
However, does the site need to be set up such that 'LOGIN' is specified just like that in the source code?
when i tried it i get this error:
>>> browser.select_ form('LOGIN')
Traceback (most recent call last):
File "<interacti ve input>", line 1, in <module>
File "C:\Python25\li b\site-packages\mechan ize\_mechanize. py", line 510, in select_form
raise FormNotFoundErr or("no form matching "+descripti on)
FormNotFoundErr or: no form matching name 'LOGIN'
thanks
Comment