"tornado.platform.asyncio",
"tornado.platform.caresresolver",
"tornado.platform.twisted",
+ "tornado.simple_httpclient",
]
# I wish this could go in a per-module file...
coverage_ignore_classes = [
* ``curl_httpclient`` is faster.
-* ``curl_httpclient`` was the default prior to Tornado 2.0.
-
Note that if you are using ``curl_httpclient``, it is highly
recommended that you use a recent version of ``libcurl`` and
``pycurl``. Currently the minimum supported version of libcurl is
from tornado.ioloop import IOLoop
from tornado.util import Configurable
-from typing import Type, Any, Union, Dict, Callable, Optional, cast
+from typing import Type, Any, Union, Dict, Callable, Optional, cast, Awaitable
class HTTPClient(object):
request: Union[str, "HTTPRequest"],
raise_error: bool = True,
**kwargs: Any
- ) -> "Future[HTTPResponse]":
+ ) -> Awaitable["HTTPResponse"]:
"""Executes a request, asynchronously returning an `HTTPResponse`.
The request may be either a string URL or an `HTTPRequest` object.
# License for the specific language governing permissions and limitations
# under the License.
-"""
-Unittest for the twisted-style reactor.
-"""
-
+import asyncio
import logging
import signal
import unittest
def tornado_fetch(self, url, runner):
client = AsyncHTTPClient()
- fut = client.fetch(url)
+ fut = asyncio.ensure_future(client.fetch(url))
fut.add_done_callback(lambda f: self.stop_loop())
runner()
return fut.result()