From: Ben Darnell Date: Sun, 30 Dec 2018 17:42:42 +0000 (-0500) Subject: httpclient: Update docs X-Git-Tag: v6.0.0b1~9^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=129594146cfff7f10fe3c1fbde7725118fd79494;p=thirdparty%2Ftornado.git httpclient: Update docs --- diff --git a/docs/conf.py b/docs/conf.py index 04668eaf0..f0cfa9c29 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,6 +38,7 @@ coverage_ignore_modules = [ "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 = [ diff --git a/docs/httpclient.rst b/docs/httpclient.rst index cf3bc8e71..178dc1480 100644 --- a/docs/httpclient.rst +++ b/docs/httpclient.rst @@ -47,7 +47,9 @@ Implementations ~~~~~~~~~~~~~~~ .. automodule:: tornado.simple_httpclient - :members: + + .. autoclass:: SimpleAsyncHTTPClient + :members: .. module:: tornado.curl_httpclient diff --git a/tornado/httpclient.py b/tornado/httpclient.py index 8606c01e6..e02c60e3d 100644 --- a/tornado/httpclient.py +++ b/tornado/httpclient.py @@ -20,8 +20,6 @@ to switch to ``curl_httpclient`` for reasons such as the following: * ``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 @@ -55,7 +53,7 @@ from tornado import gen, httputil 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): @@ -251,7 +249,7 @@ class AsyncHTTPClient(Configurable): 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. diff --git a/tornado/test/twisted_test.py b/tornado/test/twisted_test.py index 06c49e3b4..0e03cec9f 100644 --- a/tornado/test/twisted_test.py +++ b/tornado/test/twisted_test.py @@ -13,10 +13,7 @@ # 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 @@ -120,7 +117,7 @@ class CompatibilityTests(unittest.TestCase): 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()