tortik.page.RequestHandler
— base class for request handle¶
Base class for request handle¶
-
class
tortik.page.
RequestHandler
(application, request, **kwargs)[source]¶ Base handler for request handle
Differs from
tornado.web.RequestHandler
that all method handlers are@tornado.web.asynchronous
by default.Handler completion should be done with
self.complete
method instead ofself.finish
for applying postprocessors.
RequestHandler¶
Methods¶
-
RequestHandler.
make_request
(name, method='GET', full_url=None, url_prefix=None, path='', data='', headers=None, connect_timeout=1, request_timeout=2, follow_redirects=True, **kwargs)[source]¶ Class for easier constructing
tornado.httpclient.HTTPRequest
object.Request url could be constructed with two ways:
full_url
argumenturl_prefix
as domain part andpath
as path part
Parameters: - name (string) – Name of the request (for later accessing response through
self.responses.get(name)
) - method (string) – HTTP method, e.g. “GET” or “POST”
- full_url (string) – Full url for the requesting server (ex.
http://example.com
) - url_prefix (string) – Request url domain part
- path (string) – Request url path part
- data (
string
ordict
) – Query to be passed to the request (could be a dict and would be translated to a query string) - headers (
tornado.httputil.HTTPHeaders
ordict
) – Additional HTTP headers to pass on the request - connect_timeout (float) – Timeout for initial connection in seconds
- request_timeout (float) – Timeout for entire request in seconds
- follow_redirects (bool) – Should redirects be followed automatically or return the 3xx response?
- kwargs – any other
tornado.httpclient.HTTPRequest
arguments
Returns: tornado.httpclient.HTTPRequest