Sunday, August 18, 2013

Re: How do I create a script to fill in django admin login form and submit?

Ok, I've gotten further. I have confirmed the problem was related to the csrf token. This is my new code:


client = requests.session()    # Retrieve the CSRF token first  client.get(URL)  # sets the cookie  csrftoken = client.cookies['csrftoken']    login_data = dict(Username='jim', Password='beam, csrfmiddlewaretoken=csrftoken)  r = client.post(URL, data=login_data)

Now, I get a 200 for the status code, but it still doesn't actually login..........


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate