| Server IP : 54.37.205.81 / Your IP : 216.73.216.76 Web Server : nginx/1.22.1 System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64 User : debian ( 1000) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/tornado/__pycache__/ |
Upload File : |
�
��b�| � � � d Z ddlZddlZddlmZ ddlZddlZddlZddlm Z m
Z
mZ ddlm
Z
mZ ddlmZmZ ddlmZ ddlmZ dd lmZmZmZmZmZmZmZ G d
� de� � Z G d� d
e� � Z G d� de� � Z! G d� de� � Z" G d� de#� � Z$e$Z% G d� de� � Z&dd�Z'e(dk r e'� � dS dS )a� Blocking and non-blocking HTTP client interfaces.
This module defines a common interface shared by two implementations,
``simple_httpclient`` and ``curl_httpclient``. Applications may either
instantiate their chosen implementation class directly or use the
`AsyncHTTPClient` class from this module, which selects an implementation
that can be overridden with the `AsyncHTTPClient.configure` method.
The default implementation is ``simple_httpclient``, and this is expected
to be suitable for most users' needs. However, some applications may wish
to switch to ``curl_httpclient`` for reasons such as the following:
* ``curl_httpclient`` has some features not found in ``simple_httpclient``,
including support for HTTP proxies and the ability to use a specified
network interface.
* ``curl_httpclient`` is more likely to be compatible with sites that are
not-quite-compliant with the HTTP spec, or sites that use little-exercised
features of HTTP.
* ``curl_httpclient`` is faster.
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
7.22.0, and the minimum version of pycurl is 7.18.2. It is highly
recommended that your ``libcurl`` installation is built with
asynchronous DNS resolver (threaded or c-ares), otherwise you may
encounter various problems with request timeouts (for more
information, see
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTCONNECTTIMEOUTMS
and comments in curl_httpclient.py).
To select ``curl_httpclient``, call `AsyncHTTPClient.configure` at startup::
AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient")
� N)�BytesIO)�Future�"future_set_result_unless_cancelled�%future_set_exception_unless_cancelled)�utf8�
native_str)�gen�httputil)�IOLoop)�Configurable)�Type�Any�Union�Dict�Callable�Optional�castc �^ � e Zd ZdZ ddddeddfd�Zdd�Zdd �Zd
ede f deddfd
�Z
dS )�
HTTPClienta� A blocking HTTP client.
This interface is provided to make it easier to share code between
synchronous and asynchronous applications. Applications that are
running an `.IOLoop` must use `AsyncHTTPClient` instead.
Typical usage looks like this::
http_client = httpclient.HTTPClient()
try:
response = http_client.fetch("http://www.google.com/")
print(response.body)
except httpclient.HTTPError as e:
# HTTPError is raised for non-200 responses; the response
# can be found in e.response.
print("Error: " + str(e))
except Exception as e:
# Other errors are possible, such as IOError.
print("Error: " + str(e))
http_client.close()
.. versionchanged:: 5.0
Due to limitations in `asyncio`, it is no longer possible to
use the synchronous ``HTTPClient`` while an `.IOLoop` is running.
Use `AsyncHTTPClient` instead.
N�async_client_classzOptional[Type[AsyncHTTPClient]]�kwargs�returnc � ��� d| _ t d�� � | _ ��t �d��fd�}| j � |� � | _ d| _ d S )NTF)�make_currentr �AsyncHTTPClientc � �T �K � t j d� � � d {V �� � �J � � di ���S )Nr � )r �sleep)r r s ���4/usr/lib/python3/dist-packages/tornado/httpclient.py�make_clientz(HTTPClient.__init__.<locals>.make_clienth sJ �� � � ��)�A�,�,��������%�1�1�1�%�%�/�/��/�/�/� )r r )�_closedr �_io_loopr �run_sync�
_async_client)�selfr r r s `` r �__init__zHTTPClient.__init__Y ss ��� � ����E�2�2�2��
��%�!0�� 0� 0� 0� 0� 0� 0� 0�
"�]�3�3�K�@�@�������r! c �. � | � � � d S �N)�close�r&