kwargs = {}
-version = "3.3.dev1"
+version = "4.0.dev1"
with open('README.rst') as f:
kwargs['long_description'] = f.read()
# is zero for an official release, positive for a development branch,
# or negative for a release candidate or beta (after the base version
# number has been incremented)
-version = "3.3.dev1"
-version_info = (3, 3, 0, -100)
+version = "4.0.dev1"
+version_info = (4, 0, 0, -100)
response_type='code',
extra_params={'approval_prompt': 'auto'})
-.. versionchanged:: 3.3
+.. versionchanged:: 4.0
All of the callback interfaces in this module are now guaranteed
to run their callback with an argument of ``None`` on error.
Previously some functions would do this while others would simply
This functionality was previously available in a separate class
``TracebackFuture``, which is now a deprecated alias for this class.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
`tornado.concurrent.Future` is always a thread-unsafe ``Future``
with support for the ``exc_info`` methods. Previously it would
be an alias for the thread-safe `concurrent.futures.Future`
def exc_info(self):
"""Returns a tuple in the same format as `sys.exc_info` or None.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
return self._exc_info
Preserves tracebacks on Python 2.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
self._exc_info = exc_info
self.set_exception(exc_info[1])
func(args, callback=(yield gen.Callback(key)))
result = yield gen.Wait(key)
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
``gen.Task`` is now a function that returns a `.Future`, instead of
a subclass of `YieldPoint`. It still behaves the same way when
yielded.
This function is faster than the `Multi` `YieldPoint` because it does not
require the creation of a stack context.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
if isinstance(children, dict):
keys = list(children.keys())
Currently only supports Futures, not other `YieldPoint` classes.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
# TODO: allow yield points in addition to futures?
# Tricky to do with stack_context semantics.
Usage: ``yield gen.moment``
-.. versionadded:: 3.3
+.. versionadded:: 4.0
"""
moment.set_result(None)
"""Client and server implementations of HTTP/1.x.
-.. versionadded:: 3.3
+.. versionadded:: 4.0
"""
from __future__ import absolute_import, division, print_function, with_statement
def set_close_callback(self, callback):
"""Sets a callback that will be run when the connection is closed.
- .. deprecated:: 3.3
+ .. deprecated:: 4.0
Use `.HTTPMessageDelegate.on_connection_close` instead.
"""
self._close_callback = stack_context.wrap(callback)
``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 3.3
+ 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".
.. versionadded:: 3.1
The ``auth_mode`` argument.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
The ``body_producer`` and ``expect_100_continue`` arguments.
"""
# Note that some of these attributes go through property setters
class except to start a server at the beginning of the process
(and even that is often done indirectly via `tornado.web.Application.listen`).
-.. versionchanged:: 3.3
+.. versionchanged:: 4.0
The ``HTTPRequest`` class that used to live in this module has been moved
to `tornado.httputil.HTTPServerRequest`. The old name remains as an alias.
servers if you want to create your listening sockets in some
way other than `tornado.netutil.bind_sockets`.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added ``gzip``, ``chunk_size``, ``max_header_size``,
``idle_connection_timeout``, ``body_timeout``, ``max_body_size``
arguments. Added support for `.HTTPServerConnectionDelegate`
are typically kept open in HTTP/1.1, multiple requests can be handled
sequentially on a single connection.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Moved from ``tornado.httpserver.HTTPRequest``.
"""
def __init__(self, method=None, uri=None, version="HTTP/1.0", headers=None,
def supports_http_1_1(self):
"""Returns True if this request supports HTTP/1.1 semantics.
- .. deprecated:: 3.3
+ .. deprecated:: 4.0
Applications are less likely to need this information with the
introduction of `.HTTPConnection`. If you still need it, access
the ``version`` attribute directly.
def write(self, chunk, callback=None):
"""Writes the given chunk to the response stream.
- .. deprecated:: 3.3
+ .. deprecated:: 4.0
Use ``request.connection`` and the `.HTTPConnection` methods
to write the response.
"""
def finish(self):
"""Finishes this HTTP request on the open connection.
- .. deprecated:: 3.3
+ .. deprecated:: 4.0
Use ``request.connection`` and the `.HTTPConnection` methods
to write the response.
"""
"""Exception class for malformed HTTP requests or responses
from remote sources.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
pass
class HTTPOutputException(Exception):
"""Exception class for errors in HTTP output.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
pass
class HTTPServerConnectionDelegate(object):
"""Implement this interface to handle requests from `.HTTPServer`.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
def start_request(self, server_conn, request_conn):
"""This method is called by the server when a new request has started.
class HTTPMessageDelegate(object):
"""Implement this interface to handle an HTTP request or response.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
def headers_received(self, start_line, headers):
"""Called when the HTTP headers have been received and parsed.
class HTTPConnection(object):
"""Applications use this interface to write their responses.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
def write_headers(self, start_line, headers, chunk=None, callback=None):
"""Write an HTTP header block.
def clear_instance():
"""Clear the global `IOLoop` instance.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
if hasattr(IOLoop, "_instance"):
del IOLoop._instance
When an event occurs, ``handler(fd, events)`` will be run.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added the ability to pass file-like objects in addition to
raw file descriptors.
"""
def update_handler(self, fd, events):
"""Changes the events we listen for ``fd``.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added the ability to pass file-like objects in addition to
raw file descriptors.
"""
def remove_handler(self, fd):
"""Stop listening for events on ``fd``.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added the ability to pass file-like objects in addition to
raw file descriptors.
"""
This method is provided for use by `IOLoop` subclasses and should
not generally be used by application code.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
try:
return fd.fileno(), fd
implementations of ``IOLoop.close(all_fds=True)`` and should
not generally be used by application code.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
try:
try:
:arg max_write_buffer_size: Amount of outgoing data to buffer;
defaults to unlimited.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Add the ``max_write_buffer_size`` parameter. Changed default
``read_chunk_size`` to 64KB.
"""
if more than ``max_bytes`` bytes have been read and the regex is
not satisfied.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added the ``max_bytes`` argument. The ``callback`` argument is
now optional and a `.Future` will be returned if it is omitted.
"""
if more than ``max_bytes`` bytes have been read and the delimiter
is not found.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added the ``max_bytes`` argument. The ``callback`` argument is
now optional and a `.Future` will be returned if it is omitted.
"""
If ``partial`` is true, the callback is run as soon as we have
any bytes to return (but never more than ``num_bytes``)
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added the ``partial`` argument. The callback argument is now
optional and a `.Future` will be returned if it is omitted.
"""
If a callback is given, it will be run with the data as an argument;
if not, this method returns a `.Future`.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
The callback argument is now optional and a `.Future` will
be returned if it is omitted.
"""
completed. If `write` is called again before that `.Future` has
resolved, the previous future will be orphaned and will never resolve.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Now returns a `.Future` if no callback is given.
"""
assert isinstance(data, bytes_type)
is ready. Calling `IOStream` read methods before the socket is
connected works on some platforms but is non-portable.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
If no callback is given, returns a `.Future`.
"""
self._connecting = True
If a close callback is defined on this stream, it will be
transferred to the new stream.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
if (self._read_callback or self._read_future or
self._write_callback or self._write_future or
The ``timeout`` argument and ``ASYNC_TEST_TIMEOUT`` environment
variable.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
The wrapper now passes along ``*args, **kwargs`` so it can be used
on functions with arguments.
"""
if another flush occurs before the previous flush's callback
has been run, the previous callback will be discarded.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Now returns a `.Future` if no callback is given.
"""
chunk = b"".join(self._write_buffer)
.. versionadded:: 3.1
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
This method is now always called, instead of only when
partial results are requested.
"""
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Now compresses all mime types beginning with ``text/``, instead
of just a whitelist. (the whitelist is still used for certain
non-text mime types).
phrase was supplied, these values will be available as the attributes
``self.close_code`` and ``self.close_reason``.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added ``close_code`` and ``close_reason`` attributes.
"""
The ``code`` and ``reason`` arguments are ignored in the "draft76"
protocol version.
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added the ``code`` and ``reason`` arguments.
"""
browsers, since WebSockets are allowed to bypass the usual same-origin
policies and don't use CORS headers.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
parsed_origin = urlparse(origin)
origin = parsed_origin.netloc
.. versionadded:: 3.2
- .. versionchanged:: 3.3
+ .. versionchanged:: 4.0
Added the ``code`` and ``reason`` arguments.
"""
class WSGIApplication(web.Application):
"""A WSGI equivalent of `tornado.web.Application`.
- .. deprecated: 3.3::
+ .. deprecated:: 4.0
Use a regular `.Application` and wrap it in `WSGIAdapter` instead.
"""
that it is not possible to use `.AsyncHTTPClient`, or the
`tornado.auth` or `tornado.websocket` modules.
- .. versionadded:: 3.3
+ .. versionadded:: 4.0
"""
def __init__(self, application):
if isinstance(application, WSGIApplication):