Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread Александр Христюхин (roboslone)
https://docs.djangoproject.com/en/1.11/ref/csrf/#ajax > On 15 Jun 2017, at 17:20, 李余通 wrote: > > Sorry,the message of Django CSRF and X-CSRFToken i can find is less. > Can you give me an example to use requests

Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread 李余通
Sorry,the message of Django CSRF and X-CSRFToken i can find is less. Can you give me an example to use requests or urllib2 and set "X-CSRFToken" header to post form? Thank you very much! 在 2017年6月15日星期四 UTC+8下午9:37:25,Александр Христюхин写道: > > You could set "X-CSRFToken" header, that would be

Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread Александр Христюхин (roboslone)
You could set "X-CSRFToken" header, that would be enough. Why do you post data manually though? > On 15 Jun 2017, at 16:33, 李余通 wrote: > > Ture,my way is wrong,should i send cookies? > > 在 2017年6月15日星期四 UTC+8下午9:29:17,Александр Христюхин写道: > CSRF token value is

Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread 李余通
Ture,my way is wrong,should i send cookies? 在 2017年6月15日星期四 UTC+8下午9:29:17,Александр Христюхин写道: > > CSRF token value is passed in Django's response headers. > And anyway, you're no supposed to post data like that. Do you do that in > tests? > > On 15 Jun 2017, at 16:20, liyutong...@gmail.com

Re: I use requests to submit form,how to bate Django's csrfmiddlewaretoken

2017-06-15 Thread Александр Христюхин (roboslone)
CSRF token value is passed in Django's response headers. And anyway, you're no supposed to post data like that. Do you do that in tests? > On 15 Jun 2017, at 16:20, liyutong19961...@gmail.com wrote: > > I uis this code to submit form > ```python > import requests > > url =