I've try your first suggestion
but I have problem in parsing the html use pyquery
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://
www.w3.org/1999/xhtml"><head></head><body><div id="body"><div
id="content"><form action="/composebot" method="post"
class="compose"><input name="title" type="text" class="title" value=""/
><textarea name="markdown" rows="30" cols="40" class="markdown"></
textarea><input type="submit" value="Publish post" class="submit"/
><input type="hidden" name="_xsrf"
value="4436f8b0486d491c8b2e6643dc540da2"/></form></div></div></body></
html>
I still cannot the value of xsrf instead I have use
from pyquery import PyQuery as pq
d = pq(var_text)
d('input[name="_xsrf"]').val()
but I don't know why it's not working..any idea?
and
I interest with your second suggestion,
how to make it work? I still don't get it
regards
On Jun 12, 2:13 am, Ben Darnell <
b...@bendarnell.com> wrote:
> Seehttp://
www.tornadoweb.org/documentation#cross-site-request-forgery-pr...
> more information about how this works and why it is required. You'll
> have to make two requests: one to get the current token (you can make a new
> handler that just returns self.xsrf_token), and then use it in a second
> request.
>
> Actually, now that I think about it you don't even need that. You can just
> use whatever string you want as the xsrf token, as long as you pass it both
> as a cookie and as an argument or header.
>
> If this is an API endpoint not intended for browser access, you may want to
> override check_xsrf_cookie. If your authentication is not cookie-based, you
> can disable xsrf protection entirely.
>
> -Ben
>
> On Sat, Jun 11, 2011 at 4:44 AM, arief nur andono
> <
ariefnurand...@gmail.com>wrote: