]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Document AsyncHTTPClient's defaults argument.
authorBen Darnell <ben@bendarnell.com>
Sun, 15 Jun 2014 16:36:28 +0000 (12:36 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 15 Jun 2014 16:36:28 +0000 (12:36 -0400)
Closes #762.

tornado/httpclient.py

index a7a187c9b678056664bf50b0fdc2afb81dee02ec..f93c3c3cfb3a650d378f09cba02ab40cffb96a3a 100644 (file)
@@ -110,10 +110,21 @@ class AsyncHTTPClient(Configurable):
     actually creates an instance of an implementation-specific
     subclass, and instances are reused as a kind of pseudo-singleton
     (one per `.IOLoop`).  The keyword argument ``force_instance=True``
-    can be used to suppress this singleton behavior.  Constructor
-    arguments other than ``io_loop`` and ``force_instance`` are
-    deprecated.  The implementation subclass as well as arguments to
-    its constructor can be set with the static method `configure()`
+    can be used to suppress this singleton behavior.  Unless
+    ``force_instance=True`` is used, no arguments other than
+    ``io_loop`` should be passed to the `AsyncHTTPClient` constructor.
+    The implementation subclass as well as arguments to its
+    constructor can be set with the static method `configure()`
+
+    All `AsyncHTTPClient` implementations support a ``defaults``
+    keyword argument, which can be used to set default values for
+    `HTTPRequest` attributes.  For example::
+
+        AsyncHTTPClient.configure(
+            None, defaults=dict(user_agent="MyUserAgent"))
+        # or with force_instance:
+        client = AsyncHTTPClient(force_instance=True,
+            defaults=dict(user_agent="MyUserAgent"))
     """
     @classmethod
     def configurable_base(cls):