ok
Direktori : /proc/self/root/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/util/ |
Current File : //proc/self/root/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/util/timeout.pyo |
� Bu�_c @@ st d d l m Z d d l m Z d d l Z d d l m Z e � Z e e d e j � Z d e f d � � YZ d S( i ( t absolute_import( t _GLOBAL_DEFAULT_TIMEOUTNi ( t TimeoutStateErrort monotonict Timeoutc B@ s� e Z d Z e Z d e e d � Z d � Z e Z e d � � Z e d � � Z d � Z d � Z d � Z e d � � Z e d � � Z RS( s� Timeout configuration. Timeouts can be defined as a default for a pool:: timeout = Timeout(connect=2.0, read=7.0) http = PoolManager(timeout=timeout) response = http.request('GET', 'http://example.com/') Or per-request (which overrides the default for the pool):: response = http.request('GET', 'http://example.com/', timeout=Timeout(10)) Timeouts can be disabled by setting all the parameters to ``None``:: no_timeout = Timeout(connect=None, read=None) response = http.request('GET', 'http://example.com/, timeout=no_timeout) :param total: This combines the connect and read timeouts into one; the read timeout will be set to the time leftover from the connect attempt. In the event that both a connect timeout and a total are specified, or a read timeout and a total are specified, the shorter timeout will be applied. Defaults to None. :type total: integer, float, or None :param connect: The maximum amount of time (in seconds) to wait for a connection attempt to a server to succeed. Omitting the parameter will default the connect timeout to the system default, probably `the global default timeout in socket.py <http://hg.python.org/cpython/file/603b4d593758/Lib/socket.py#l535>`_. None will set an infinite timeout for connection attempts. :type connect: integer, float, or None :param read: The maximum amount of time (in seconds) to wait between consecutive read operations for a response from the server. Omitting the parameter will default the read timeout to the system default, probably `the global default timeout in socket.py <http://hg.python.org/cpython/file/603b4d593758/Lib/socket.py#l535>`_. None will set an infinite timeout. :type read: integer, float, or None .. note:: Many factors can affect the total amount of time for urllib3 to return an HTTP response. For example, Python's DNS resolver does not obey the timeout specified on the socket. Other factors that can affect total request time include high CPU load, high swap, the program running at a low priority level, or other behaviors. In addition, the read and total timeouts only measure the time between read operations on the socket connecting the client and the server, not the total amount of time for the request to return a complete response. For most requests, the timeout is raised because the server has not sent the first byte in the specified time. This is not always the case; if a server streams one byte every fifteen seconds, a timeout of 20 seconds will not trigger, even though the request will take several minutes to complete. If your goal is to cut off any request after a set amount of wall clock time, consider having a second "watcher" thread to cut off a slow request. c C@ sL | j | d � | _ | j | d � | _ | j | d � | _ d | _ d S( Nt connectt readt total( t _validate_timeoutt _connectt _readR t Nonet _start_connect( t selfR R R ( ( sQ /opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/urllib3/util/timeout.pyt __init___ s c C@ s&