Hello,
I can't find an example anywhere that I can make sense of, but I'd
like to
a. Log in to Django (getting all my cookies set)
b. Get an admin's screens data as HTML
Am I doing something wrong or have I got it all upside down...? thanks
######################################################
import urllib
import urllib2
import cookielib
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_data = urllib.urlencode({'username' : 'tomsmith', 'password' :
'XXX','hidden':'KGRwM-GOBBLEDEGOOK -
lNWViYTY0ZTI2NTU','this_is_the_login_form':"1" })
#LOGIN AND GET MY COOKIES SET
resp = opener.open('http://localhost:8771/admin/', login_data)
for i, obj in enumerate(cj):
print i, obj
print obj.value
#NOW I'M LOGGED IN.... GO GET THE PAGE....
resp2 = opener.open('http://localhost:8771/admin/bah/awmerchant/175/')
print resp2.read()
------------------------------------------------------------------------
--------
Tom Smith
http://www.everythingability.com
yahoo, aim, skype: everythingability
mob: +44 (0) 7720 288 285
tel: +44 (0) 1904 870 565
fax: +44 (0) 8716 613 413
----------- usability, findability, profitability, remarkability
---------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---