2013-03-16 15:50:31 +00:00
|
|
|
``tornado.httpclient`` --- Asynchronous HTTP client
|
2011-06-11 21:48:46 +00:00
|
|
|
===================================================
|
2011-06-09 06:58:58 +00:00
|
|
|
|
|
|
|
.. automodule:: tornado.httpclient
|
2011-06-17 07:16:40 +00:00
|
|
|
|
|
|
|
HTTP client interfaces
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
.. autoclass:: HTTPClient
|
|
|
|
:members:
|
|
|
|
|
|
|
|
.. autoclass:: AsyncHTTPClient
|
|
|
|
:members:
|
|
|
|
|
|
|
|
Request objects
|
|
|
|
---------------
|
|
|
|
.. autoclass:: HTTPRequest
|
|
|
|
:members:
|
|
|
|
|
|
|
|
Response objects
|
|
|
|
----------------
|
|
|
|
.. autoclass:: HTTPResponse
|
|
|
|
:members:
|
|
|
|
|
|
|
|
Exceptions
|
|
|
|
----------
|
|
|
|
.. autoexception:: HTTPError
|
|
|
|
:members:
|
|
|
|
|
|
|
|
Command-line interface
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
This module provides a simple command-line interface to fetch a url
|
|
|
|
using Tornado's HTTP client. Example usage::
|
|
|
|
|
|
|
|
# Fetch the url and print its body
|
|
|
|
python -m tornado.httpclient http://www.google.com
|
|
|
|
|
|
|
|
# Just print the headers
|
|
|
|
python -m tornado.httpclient --print_headers --print_body=false http://www.google.com
|
2015-04-19 16:37:43 +00:00
|
|
|
|
|
|
|
Implementations
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. automodule:: tornado.simple_httpclient
|
|
|
|
:members:
|
|
|
|
|
|
|
|
.. module:: tornado.curl_httpclient
|
|
|
|
|
2017-05-22 03:57:46 +00:00
|
|
|
.. class:: CurlAsyncHTTPClient(max_clients=10, defaults=None)
|
2015-04-19 16:37:43 +00:00
|
|
|
|
|
|
|
``libcurl``-based HTTP client.
|
2016-11-05 01:42:01 +00:00
|
|
|
|
|
|
|
Example Code
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* `A simple webspider <https://github.com/tornadoweb/tornado/blob/master/demos/webspider/webspider.py>`_
|
|
|
|
shows how to fetch URLs concurrently.
|
|
|
|
* `The file uploader demo <https://github.com/tornadoweb/tornado/tree/master/demos/file_upload/>`_
|
|
|
|
uses either HTTP POST or HTTP PUT to upload files to a server.
|