1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
``tornado.platform.twisted`` --- Bridges between Twisted and Tornado
====================================================================
.. module:: tornado.platform.twisted
.. deprecated:: 6.0
This module is no longer recommended for new code. Instead of using
direct integration between Tornado and Twisted, new applications should
rely on the integration with ``asyncio`` provided by both packages.
Importing this module has the side effect of registering Twisted's ``Deferred``
class with Tornado's ``@gen.coroutine`` so that ``Deferred`` objects can be
used with ``yield`` in coroutines using this decorator (importing this module has
no effect on native coroutines using ``async def``).
.. function:: install()
Install ``AsyncioSelectorReactor`` as the default Twisted reactor.
.. deprecated:: 5.1
This function is provided for backwards compatibility; code
that does not require compatibility with older versions of
Tornado should use
``twisted.internet.asyncioreactor.install()`` directly.
.. versionchanged:: 6.0.3
In Tornado 5.x and before, this function installed a reactor
based on the Tornado ``IOLoop``. When that reactor
implementation was removed in Tornado 6.0.0, this function was
removed as well. It was restored in Tornado 6.0.3 using the
``asyncio`` reactor instead.
Twisted DNS resolver
--------------------
.. class:: TwistedResolver
Twisted-based asynchronous resolver.
This is a non-blocking and non-threaded resolver. It is
recommended only when threads cannot be used, since it has
limitations compared to the standard ``getaddrinfo``-based
`~tornado.netutil.Resolver` and
`~tornado.netutil.DefaultExecutorResolver`. Specifically, it returns at
most one result, and arguments other than ``host`` and ``family``
are ignored. It may fail to resolve when ``family`` is not
``socket.AF_UNSPEC``.
Requires Twisted 12.1 or newer.
.. versionchanged:: 5.0
The ``io_loop`` argument (deprecated since version 4.1) has been removed.
.. deprecated:: 6.2
This class is deprecated and will be removed in Tornado 7.0. Use the default
thread-based resolver instead.
|