hello,
I want to automate some interaction with my web2py application web
interface but am having trouble logging in.
I am using the builtin auth login form.
Has anyone succeeded in building such a script, or can see what is
wrong with my script below?
import urllib
import urllib2
import cookielib
cj = cookielib.LWPCookieJar() # use cookies
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
post_data = urllib.urlencode({'email': email, 'password': password,
'_formkey': '435ds2a5-3427-4d8f-45b9-0b5da0453351'})
request = urllib2.Request(login_url, post_data)
response = opener.open(request)
Some thoughts:
- is a formkey necessary, and does it need to be unique?
- do I need to use multipart encoded data? (which Python's builtin
libraries do not support)
thanks,
Richard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---