class_docstr: HTTP client request object.
class_docstr_tok: ["HTTP","client","request","object","."]
docstr: All parameters except ``url`` are optional.
  
  :arg string url: URL to fetch
  :arg string method: HTTP method, e.g. "GET" or "POST"
  :arg headers: Additional HTTP headers to pass on the request
  :type headers: `~tornado.httputil.HTTPHeaders` or `dict`
  :arg body: HTTP request body as a string (byte or unicode; if unicode
     the utf-8 encoding will be used)
  :arg body_producer: Callable used for lazy/asynchronous request bodies.
     It is called with one argument, a ``write`` function, and should
     return a `.Future`.  It should call the write function with new
     data as it becomes available.  The write function returns a
     `.Future` which can be used for flow control.
     Only one of ``body`` and ``body_producer`` may
     be specified.  ``body_producer`` is not supported on
     ``curl_httpclient``.  When using ``body_producer`` it is recommended
     to pass a ``Content-Length`` in the headers as otherwise chunked
     encoding will be used, and many servers do not support chunked
     encoding on requests.  New in Tornado 4.0
  :arg string auth_username: Username for HTTP authentication
  :arg string auth_password: Password for HTTP authentication
  :arg string auth_mode: Authentication mode; default is "basic".
     Allowed values are implementation-defined; ``curl_httpclient``
     supports "basic" and "digest"; ``simple_httpclient`` only supports
     "basic"
  :arg float connect_timeout: Timeout for initial connection in seconds,
     default 20 seconds
  :arg float request_timeout: Timeout for entire request in seconds,
     default 20 seconds
  :arg if_modified_since: Timestamp for ``If-Modified-Since`` header
  :type if_modified_since: `datetime` or `float`
  :arg bool follow_redirects: Should redirects be followed automatically
     or return the 3xx response? Default True.
  :arg int max_redirects: Limit for ``follow_redirects``, default 5.
  :arg string user_agent: String to send as ``User-Agent`` header
  :arg bool decompress_response: Request a compressed response from
     the server and decompress it after downloading.  Default is True.
     New in Tornado 4.0.
  :arg bool use_gzip: Deprecated alias for ``decompress_response``
     since Tornado 4.0.
  :arg string network_interface: Network interface to use for request.
     ``curl_httpclient`` only; see note below.
  :arg callable streaming_callback: If set, ``streaming_callback`` will
     be run with each chunk of data as it is received, and
     ``HTTPResponse.body`` and ``HTTPResponse.buffer`` will be empty in
     the final response.
  :arg callable header_callback: If set, ``header_callback`` will
     be run with each header line as it is received (including the
     first line, e.g. ``HTTP/1.0 200 OK\r\n``, and a final line
     containing only ``\r\n``.  All lines include the trailing newline
     characters).  ``HTTPResponse.headers`` will be empty in the final
     response.  This is most useful in conjunction with
     ``streaming_callback``, because it's the only way to get access to
     header data while the request is in progress.
  :arg callable prepare_curl_callback: If set, will be called with
     a ``pycurl.Curl`` object to allow the application to make additional
     ``setopt`` calls.
  :arg string proxy_host: HTTP proxy hostname.  To use proxies,
     ``proxy_host`` and ``proxy_port`` must be set; ``proxy_username``,
     ``proxy_pass`` and ``proxy_auth_mode`` are optional.  Proxies are
     currently only supported with ``curl_httpclient``.
  :arg int proxy_port: HTTP proxy port
  :arg string proxy_username: HTTP proxy username
  :arg string proxy_password: HTTP proxy password
  :arg string proxy_auth_mode: HTTP proxy Authentication mode;
     default is "basic". supports "basic" and "digest"
  :arg bool allow_nonstandard_methods: Allow unknown values for ``method``
     argument? Default is False.
  :arg bool validate_cert: For HTTPS requests, validate the server's
     certificate? Default is True.
  :arg string ca_certs: filename of CA certificates in PEM format,
     or None to use defaults.  See note below when used with
     ``curl_httpclient``.
  :arg string client_key: Filename for client SSL key, if any.  See
     note below when used with ``curl_httpclient``.
  :arg string client_cert: Filename for client SSL certificate, if any.
     See note below when used with ``curl_httpclient``.
  :arg ssl.SSLContext ssl_options: `ssl.SSLContext` object for use in
     ``simple_httpclient`` (unsupported by ``curl_httpclient``).
     Overrides ``validate_cert``, ``ca_certs``, ``client_key``,
     and ``client_cert``.
  :arg bool allow_ipv6: Use IPv6 when available?  Default is true.
  :arg bool expect_100_continue: If true, send the
     ``Expect: 100-continue`` header and wait for a continue response
     before sending the request body.  Only supported with
     simple_httpclient.
  
  .. note::
  
      When using ``curl_httpclient`` certain options may be
      inherited by subsequent fetches because ``pycurl`` does
      not allow them to be cleanly reset.  This applies to the
      ``ca_certs``, ``client_key``, ``client_cert``, and
      ``network_interface`` arguments.  If you use these
      options, you should pass them on every request (you don't
      have to always use the same values, but it's not possible
      to mix requests that specify these options with ones that
      use the defaults).
  
  .. versionadded:: 3.1
     The ``auth_mode`` argument.
  
  .. versionadded:: 4.0
     The ``body_producer`` and ``expect_100_continue`` arguments.
  
  .. versionadded:: 4.2
     The ``ssl_options`` argument.
  
  .. versionadded:: 4.5
     The ``proxy_auth_mode`` argument.
code: def __init__(
      self,
      url,
      method="GET",
      headers=None,
      body=None,
      auth_username=None,
      auth_password=None,
      auth_mode=None,
      connect_timeout=None,
      request_timeout=None,
      if_modified_since=None,
      follow_redirects=None,
      max_redirects=None,
      user_agent=None,
      use_gzip=None,
      network_interface=None,
      streaming_callback=None,
      header_callback=None,
      prepare_curl_callback=None,
      proxy_host=None,
      proxy_port=None,
      proxy_username=None,
      proxy_password=None,
      proxy_auth_mode=None,
      allow_nonstandard_methods=None,
      validate_cert=None,
      ca_certs=None,
      allow_ipv6=None,
      client_key=None,
      client_cert=None,
      body_producer=None,
      expect_100_continue=False,
      decompress_response=None,
      ssl_options=None,
  ):
      r"""All parameters except ``url`` are optional.
  
      :arg string url: URL to fetch
      :arg string method: HTTP method, e.g. "GET" or "POST"
      :arg headers: Additional HTTP headers to pass on the request
      :type headers: `~tornado.httputil.HTTPHeaders` or `dict`
      :arg body: HTTP request body as a string (byte or unicode; if unicode
         the utf-8 encoding will be used)
      :arg body_producer: Callable used for lazy/asynchronous request bodies.
         It is called with one argument, a ``write`` function, and should
         return a `.Future`.  It should call the write function with new
         data as it becomes available.  The write function returns a
         `.Future` which can be used for flow control.
         Only one of ``body`` and ``body_producer`` may
         be specified.  ``body_producer`` is not supported on
         ``curl_httpclient``.  When using ``body_producer`` it is recommended
         to pass a ``Content-Length`` in the headers as otherwise chunked
         encoding will be used, and many servers do not support chunked
         encoding on requests.  New in Tornado 4.0
      :arg string auth_username: Username for HTTP authentication
      :arg string auth_password: Password for HTTP authentication
      :arg string auth_mode: Authentication mode; default is "basic".
         Allowed values are implementation-defined; ``curl_httpclient``
         supports "basic" and "digest"; ``simple_httpclient`` only supports
         "basic"
      :arg float connect_timeout: Timeout for initial connection in seconds,
         default 20 seconds
      :arg float request_timeout: Timeout for entire request in seconds,
         default 20 seconds
      :arg if_modified_since: Timestamp for ``If-Modified-Since`` header
      :type if_modified_since: `datetime` or `float`
      :arg bool follow_redirects: Should redirects be followed automatically
         or return the 3xx response? Default True.
      :arg int max_redirects: Limit for ``follow_redirects``, default 5.
      :arg string user_agent: String to send as ``User-Agent`` header
      :arg bool decompress_response: Request a compressed response from
         the server and decompress it after downloading.  Default is True.
         New in Tornado 4.0.
      :arg bool use_gzip: Deprecated alias for ``decompress_response``
         since Tornado 4.0.
      :arg string network_interface: Network interface to use for request.
         ``curl_httpclient`` only; see note below.
      :arg callable streaming_callback: If set, ``streaming_callback`` will
         be run with each chunk of data as it is received, and
         ``HTTPResponse.body`` and ``HTTPResponse.buffer`` will be empty in
         the final response.
      :arg callable header_callback: If set, ``header_callback`` will
         be run with each header line as it is received (including the
         first line, e.g. ``HTTP/1.0 200 OK\r\n``, and a final line
         containing only ``\r\n``.  All lines include the trailing newline
         characters).  ``HTTPResponse.headers`` will be empty in the final
         response.  This is most useful in conjunction with
         ``streaming_callback``, because it's the only way to get access to
         header data while the request is in progress.
      :arg callable prepare_curl_callback: If set, will be called with
         a ``pycurl.Curl`` object to allow the application to make additional
         ``setopt`` calls.
      :arg string proxy_host: HTTP proxy hostname.  To use proxies,
         ``proxy_host`` and ``proxy_port`` must be set; ``proxy_username``,
         ``proxy_pass`` and ``proxy_auth_mode`` are optional.  Proxies are
         currently only supported with ``curl_httpclient``.
      :arg int proxy_port: HTTP proxy port
      :arg string proxy_username: HTTP proxy username
      :arg string proxy_password: HTTP proxy password
      :arg string proxy_auth_mode: HTTP proxy Authentication mode;
         default is "basic". supports "basic" and "digest"
      :arg bool allow_nonstandard_methods: Allow unknown values for ``method``
         argument? Default is False.
      :arg bool validate_cert: For HTTPS requests, validate the server's
         certificate? Default is True.
      :arg string ca_certs: filename of CA certificates in PEM format,
         or None to use defaults.  See note below when used with
         ``curl_httpclient``.
      :arg string client_key: Filename for client SSL key, if any.  See
         note below when used with ``curl_httpclient``.
      :arg string client_cert: Filename for client SSL certificate, if any.
         See note below when used with ``curl_httpclient``.
      :arg ssl.SSLContext ssl_options: `ssl.SSLContext` object for use in
         ``simple_httpclient`` (unsupported by ``curl_httpclient``).
         Overrides ``validate_cert``, ``ca_certs``, ``client_key``,
         and ``client_cert``.
      :arg bool allow_ipv6: Use IPv6 when available?  Default is true.
      :arg bool expect_100_continue: If true, send the
         ``Expect: 100-continue`` header and wait for a continue response
         before sending the request body.  Only supported with
         simple_httpclient.
  
      .. note::
  
          When using ``curl_httpclient`` certain options may be
          inherited by subsequent fetches because ``pycurl`` does
          not allow them to be cleanly reset.  This applies to the
          ``ca_certs``, ``client_key``, ``client_cert``, and
          ``network_interface`` arguments.  If you use these
          options, you should pass them on every request (you don't
          have to always use the same values, but it's not possible
          to mix requests that specify these options with ones that
          use the defaults).
  
      .. versionadded:: 3.1
         The ``auth_mode`` argument.
  
      .. versionadded:: 4.0
         The ``body_producer`` and ``expect_100_continue`` arguments.
  
      .. versionadded:: 4.2
         The ``ssl_options`` argument.
  
      .. versionadded:: 4.5
         The ``proxy_auth_mode`` argument.
      """
      # Note that some of these attributes go through property setters
      # defined below.
      self.headers = headers
      if if_modified_since:
          self.headers["If-Modified-Since"] = httputil.format_timestamp(
              if_modified_since
          )
      self.proxy_host = proxy_host
      self.proxy_port = proxy_port
      self.proxy_username = proxy_username
      self.proxy_password = proxy_password
      self.proxy_auth_mode = proxy_auth_mode
      self.url = url
      self.method = method
      self.body = body
      self.body_producer = body_producer
      self.auth_username = auth_username
      self.auth_password = auth_password
      self.auth_mode = auth_mode
      self.connect_timeout = connect_timeout
      self.request_timeout = request_timeout
      self.follow_redirects = follow_redirects
      self.max_redirects = max_redirects
      self.user_agent = user_agent
      if decompress_response is not None:
          self.decompress_response = decompress_response
      else:
          self.decompress_response = use_gzip
      self.network_interface = network_interface
      self.streaming_callback = streaming_callback
      self.header_callback = header_callback
      self.prepare_curl_callback = prepare_curl_callback
      self.allow_nonstandard_methods = allow_nonstandard_methods
      self.validate_cert = validate_cert
      self.ca_certs = ca_certs
      self.allow_ipv6 = allow_ipv6
      self.client_key = client_key
      self.client_cert = client_cert
      self.ssl_options = ssl_options
      self.expect_100_continue = expect_100_continue
      self.start_time = time.time()
  
imports: from __future__ import absolute_import, division, print_function
  import functools
  import time
  import weakref
  from tornado.concurrent import TracebackFuture
  from tornado.escape import utf8, native_str
  from tornado import httputil, stack_context
  from tornado.ioloop import IOLoop
  from tornado.util import Configurable
label_desc: Use image node_id 1 to create a new HTTPRequest object from inherited base classes: object with example: obj = HTTPRequest(url, method, headers, body, auth_username, auth_password, auth_mode, connect_timeout, request_timeout, if_modified_since, follow_redirects, max_redirects, user_agent, use_gzip, network_interface, streaming_callback, header_callback, prepare_curl_callback, proxy_host, proxy_port, proxy_username, proxy_password, proxy_auth_mode, allow_nonstandard_methods, validate_cert, ca_certs, allow_ipv6, client_key, client_cert, body_producer, expect_100_continue, decompress_response, ssl_options)