Check out Collin's email from earlier, it has an example using curl but you should be able to adapt your web request with the cookie and POST values via the python script. The cookie and POST values for the CSRF token can be anything, they just need to match.
https://groups.google.com/d/msgid/django-users/fb6e54a8-c9e7-45f7-882f-bc05c8ee90d2%40googlegroups.com?utm_medium=email&utm_source=footer -James On Dec 5, 2014 8:16 PM, "Larry Martell" <[email protected]> wrote: > I have a django view that normally receives POSTed data from a web > page. That all works fine. But now we also want to call that view from > a python script. That is failing with a 403 because of a CSRF > mismatch. I can disable CSRF on my view and then it does work from the > script. > > Is there some way I can have it work with CSRF with my script? > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CACwCsY6tVsLCdNSwi0VnSx2JhGQew%2Be9fTU%2BadgT%2BdL%2BJFNFiw%40mail.gmail.com > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWgYvFoXtC7PSKY-ijgpj82vHdkhJhrms4-0yEfk6KgWA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

