I would like to sign onto a web page, but am having a difficult time determine 
what parameters to pass in my sign in.  For a simple test, I am trying to parse 
text on a "friends" status page on twitter.  This is not via the API, but the 
web.

import urllib2, urllib, cookielib
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
cj = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
d={'authenticity_token':'8578471445acd12dec39b3353b71c88969f1505e', 
'username_or_email':'user','password':'pswd123'}
params = urllib.urlencode(d)
opener.open('http://twitter.com/login', params)

if not 'id' in [cookie.name for cookie in cj]:
    raise ValueError, "Login failed"

#########   result
Traceback (most recent call last):
  File "<pyshell#12>", line 2, in <module>
    raise ValueError, "Login failed"
ValueError: Login failed

How can I tell what the page is asking for, and if I am passing the correct 
parameters?



      
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to