Tornado 4.5 Documentation
else the user’s browser will simply hang. Here is an example that makes a call to the FriendFeed API using Tornado’s built-in AsyncHTTPClient: class MainHandler(tornado.web.RequestHandler): @tornado get(self): http = tornado.httpclient.AsyncHTTPClient() http.fetch("http://friendfeed-api.com/v2/feed/bret", callback=self.on_response) def on_response(self, response): write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") self.finish() When get() returns, the request has not finished. When the HTTP client eventually0 码力 | 333 页 | 322.34 KB | 1 年前3Tornado 4.5 Documentation
else the user’s browser will simply hang. Here is an example that makes a call to the FriendFeed API using Tornado’s built-in AsyncHTTPClient: class MainHandler(tornado.web.RequestHandler): @tornado asynchronous def get(self): http = tornado.httpclient.AsyncHTTPClient() http.fetch("http://friendfeed-api.com/v2/feed/bret", callback=self.on_response) def on_response(self, response): if response.error: json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") self.finish() When get() returns, the request has not finished. When the HTTP client eventually0 码力 | 222 页 | 833.04 KB | 1 年前3Tornado 6.1 Documentation
fetch("http://friendfeed-api.com/v2/feed/bret") json = tornado.escape.json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") For a more advanced per-handler basis, you can override RequestHandler. check_xsrf_cookie(). For example, if you have an API whose authentication does not use cookies, you may want to disable XSRF protection by making check_xsrf_cookie() friendfeed_consumer_key, friendfeed_consumer_secret, google_consumer_key, google_consumer_secret, facebook_api_key, facebook_secret: Used in the tornado.auth module to authenticate to various APIs. Template settings:0 码力 | 245 页 | 904.24 KB | 1 年前3Tornado 5.1 Documentation
fetch("http://friendfeed-api.com/v2/feed/bret") json = tornado.escape.json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") For a more advanced per-handler basis, you can override RequestHandler. check_xsrf_cookie(). For example, if you have an API whose authentication does not use cookies, you may want to disable XSRF protection by making check_xsrf_cookie() friendfeed_consumer_key, friendfeed_consumer_secret, google_consumer_key, google_consumer_secret, facebook_api_key, facebook_secret: Used in the tornado.auth module to authenticate to various APIs. Template settings:0 码力 | 243 页 | 895.80 KB | 1 年前3Tornado 6.4 Documentation
fetch("http://friendfeed-api.com/v2/feed/bret") json = tornado.escape.json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") 26 Chapter 6. Documentation per-handler basis, you can override RequestHandler. check_xsrf_cookie(). For example, if you have an API whose authentication does not use cookies, you may want to disable XSRF protection by making check_xsrf_cookie() friendfeed_consumer_key, friendfeed_consumer_secret, google_consumer_key, google_consumer_secret, facebook_api_key, facebook_secret: Used in the tornado.auth module to authenticate to various APIs. Template settings:0 码力 | 268 页 | 1.09 MB | 1 年前3Tornado 6.4 Documentation
fetch("http://friendfeed-api.com/v2/feed/bret") json = tornado.escape.json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") 26 Chapter 6. Documentation per-handler basis, you can override RequestHandler. check_xsrf_cookie(). For example, if you have an API whose authentication does not use cookies, you may want to disable XSRF protection by making check_xsrf_cookie() friendfeed_consumer_key, friendfeed_consumer_secret, google_consumer_key, google_consumer_secret, facebook_api_key, facebook_secret: Used in the tornado.auth module to authenticate to various APIs. Template settings:0 码力 | 268 页 | 1.09 MB | 1 年前3Tornado 6.4 Documentation
fetch("http://friendfeed-api.com/v2/feed/bret") json = tornado.escape.json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") 26 Chapter 6. Documentation per-handler basis, you can override RequestHandler. check_xsrf_cookie(). For example, if you have an API whose authentication does not use cookies, you may want to disable XSRF protection by making check_xsrf_cookie() friendfeed_consumer_key, friendfeed_consumer_secret, google_consumer_key, google_consumer_secret, facebook_api_key, facebook_secret: Used in the tornado.auth module to authenticate to various APIs. Template settings:0 码力 | 268 页 | 1.09 MB | 1 年前3Tornado 5.1 Documentation
- api.com/v2/feed/bret") json = tornado.escape.json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") For per-handler basis, you can override RequestHandler.check_xsrf_cookie(). For example, if you have an API whose authentication does not use cookies, you may want to disable XSRF protection by making check_xsrf_cookie() friendfeed_consumer_key, friendfeed_consumer_secret, google_consumer_key, google_consumer_secret, facebook_api_key, facebook_secret: Used in the tornado.auth module to authenticate to various APIs. Template settings:0 码力 | 359 页 | 347.32 KB | 1 年前3Tornado 6.5 Documentation
fetch("http://friendfeed-api.com/v2/feed/bret") json = tornado.escape.json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") 26 Chapter 6. DocumentationTornado per-handler basis, you can override RequestHandler. check_xsrf_cookie(). For example, if you have an API whose authentication does not use cookies, you may want to disable XSRF protection by making check_xsrf_cookie() friendfeed_consumer_key, friendfeed_consumer_secret, google_consumer_key, google_consumer_secret, facebook_api_key, facebook_secret: Used in the tornado.auth module to authenticate to various APIs. Template settings:0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.1 Documentation
- api.com/v2/feed/bret") json = tornado.escape.json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries " "from the FriendFeed API") For per-handler basis, you can override RequestHandler.check_xsrf_cookie(). For example, if you have an API whose authentication does not use cookies, you may want to disable XSRF protection by making check_xsrf_cookie() friendfeed_consumer_key, friendfeed_consumer_secret, google_consumer_key, google_consumer_secret, facebook_api_key, facebook_secret: Used in the tornado.auth module to authenticate to various APIs. Template settings:0 码力 | 931 页 | 708.03 KB | 1 年前3
共 20 条
- 1
- 2