Test your knowledge

  1. The main building blocks for a RESTful API in Tornado are subclasses of which the following classes:
    1. tornado.web.GenericHandler
    2. tornado.web.RequestHandler
    3. tornado.web.IncomingHTTPRequestHandler

  2. If we just want to support the GET and PATCH methods, we can override the SUPPORTED_METHODS class variable with which of the following values:
    1. ("GET", "PATCH")
    2.  {0: "GET", 1: "PATCH"}
    3. {"GET": True, "PATCH": True, "POST": False, "PUT": False}

  3. The list of tuples for a the tornado.Web.Application constructor is composed of:
    1. A regular expression (regexp) and a tornado.web.RequestHandler subclass (request_class).
    2. A regular expression (regexp) and a tornado.web.GenericHandler subclass (request_class).
    3. A regular expression (regexp) and a tornado.web.IncomingHTTPRequestHandler subclass (request_class).

  4. When we call the self.write method with a dictionary as an argument in a request handler, Tornado:
    1. Automatically writes the chunk as JSON but we have to manually set the value of the Content-Type header to application/json.
    2. Requires us to use the json.dumps method and set the value of the Content-Type header to application/json.
    3. Automatically writes the chunk as JSON and sets the value of the Content-Type header to application/json.

  5. A calls to the tornado.escape.json_decode method with self.request.body as an argument in a request handler:
    1. Generates Python objects for the JSON string of the request body and returns the generated tuple.
    2. Generates Python objects for the JSON string of the request body and returns the generated dictionary.
    3. Generates Python objects for the JSON string of the request body and returns the generated list.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.245.233