Module ImportFrom alias ImportFrom alias Import alias ImportFrom alias Assign NameStore Call NameLoad FunctionDef arguments args defaults body Expr Str Return Call AttributeLoad NameLoad attr decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Str Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad Call NameLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If CompareIs NameLoad NameLoad body Return AttributeLoad NameLoad attr If BoolOpOr CompareIs NameLoad NameLoad CompareIs NameLoad AttributeLoad NameLoad attr body Return NameLoad TryExcept body Expr Call NameLoad NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad TryExcept body If CompareLt NameLoad Num body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call NameLoad keyword NameLoad keyword NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareIsNot AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str Assign AttributeStore NameLoad attr Call NameLoad Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareIs AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str Return BinOpSub Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareIs AttributeLoad NameLoad attr NameLoad body Return AttributeLoad NameLoad attr If BoolOpOr CompareIs AttributeLoad NameLoad attr NameLoad CompareIs AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return AttributeLoad NameLoad attr Return Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str If BoolOpAnd CompareIsNot AttributeLoad NameLoad attr NameLoad CompareIsNot AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareIsNot AttributeLoad NameLoad attr NameLoad CompareIsNot AttributeLoad NameLoad attr AttributeLoad NameLoad attr body If CompareIs AttributeLoad NameLoad attr NameLoad body Return AttributeLoad NameLoad attr Return Call NameLoad Num Call NameLoad BinOpSub AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If BoolOpAnd CompareIsNot AttributeLoad NameLoad attr NameLoad CompareIsNot AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return Call NameLoad Num BinOpSub AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr orelse Return AttributeLoad NameLoad attr decorator_list NameLoad decorator_list
N/A __future__ absolute_import socket _GLOBAL_DEFAULT_TIMEOUT N/A time exceptions TimeoutStateError N/A _Default N/A object current_time N/A N/A N/A N/A N/A 
    Retrieve the current time. This function is mocked out in unit testing.
     N/A N/A N/A time time N/A Timeout N/A object N/A N/A  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 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 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.
     N/A DEFAULT_TIMEOUT _GLOBAL_DEFAULT_TIMEOUT __init__ N/A N/A self total connect read N/A None _Default _Default N/A N/A N/A self _connect N/A N/A self _validate_timeout connect connect N/A N/A self _read N/A N/A self _validate_timeout read read N/A N/A self total N/A N/A self _validate_timeout total total N/A N/A self _start_connect None N/A __str__ N/A N/A self N/A N/A N/A N/A %s(connect=%r, read=%r, total=%r) N/A N/A N/A type self __name__ N/A self _connect N/A self _read N/A self total N/A _validate_timeout N/A N/A cls value name N/A N/A N/A  Check that a timeout attribute is valid.

        :param value: The timeout value to validate
        :param name: The name of the timeout attribute to validate. This is
            used to specify in error messages.
        :return: The validated and casted version of the given value.
        :raises ValueError: If the type is not an integer or a float, or if it
            is a numeric value less than zero.
         N/A N/A value _Default N/A N/A N/A cls DEFAULT_TIMEOUT N/A N/A N/A value None N/A value N/A cls DEFAULT_TIMEOUT N/A N/A value N/A N/A N/A N/A float value N/A N/A N/A N/A TypeError ValueError N/A N/A N/A ValueError N/A Timeout value %s was %s, but it must be an int or float. N/A name value N/A N/A N/A N/A value 0 N/A N/A N/A ValueError N/A Attempted to set %s timeout to %s, but the timeout cannot be set to a value less than 0. N/A name value N/A N/A N/A TypeError N/A N/A N/A ValueError N/A Timeout value %s was %s, but it must be an int or float. N/A name value N/A value N/A classmethod from_float N/A N/A cls timeout N/A N/A N/A  Create a new Timeout from a legacy timeout value.

        The timeout value used by httplib.py sets the same timeout on the
        connect(), and recv() socket requests. This creates a :class:`Timeout`
        object that sets the individual timeouts to the ``timeout`` value
        passed to this function.

        :param timeout: The legacy timeout value.
        :type timeout: integer, float, sentinel default object, or None
        :return: Timeout object
        :rtype: :class:`Timeout`
         N/A N/A Timeout read timeout connect timeout N/A classmethod clone N/A N/A self N/A N/A N/A  Create a copy of the timeout object

        Timeout properties are stored per-pool but each request needs a fresh
        Timeout object to ensure each one has its own start/stop configured.

        :return: a copy of the timeout object
        :rtype: :class:`Timeout`
         N/A N/A Timeout connect N/A self _connect read N/A self _read total N/A self total N/A start_connect N/A N/A self N/A N/A N/A  Start the timeout clock, used during a connect() attempt

        :raises urllib3.exceptions.TimeoutStateError: if you attempt
            to start a timer that has been started already.
         N/A N/A N/A self _start_connect None N/A N/A N/A TimeoutStateError Timeout timer has already been started. N/A N/A self _start_connect N/A current_time N/A N/A self _start_connect N/A get_connect_duration N/A N/A self N/A N/A N/A  Gets the time elapsed since the call to :meth:`start_connect`.

        :return: Elapsed time.
        :rtype: float
        :raises urllib3.exceptions.TimeoutStateError: if you attempt
            to get duration for a timer that hasn't been started.
         N/A N/A N/A self _start_connect None N/A N/A N/A TimeoutStateError Can't get connect duration for timer that has not started. N/A N/A N/A current_time N/A self _start_connect N/A connect_timeout N/A N/A self N/A N/A N/A  Get the value to use when setting a connection timeout.

        This will be a positive float or integer, the value None
        (never timeout), or the default system timeout.

        :return: Connect timeout.
        :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
         N/A N/A N/A self total None N/A N/A N/A self _connect N/A N/A N/A N/A self _connect None N/A N/A self _connect N/A self DEFAULT_TIMEOUT N/A N/A N/A self total N/A N/A min N/A self _connect N/A self total N/A property read_timeout N/A N/A self N/A N/A N/A  Get the value for the read timeout.

        This assumes some time has elapsed in the connection timeout and
        computes the read timeout appropriately.

        If self.total is set, the read timeout is dependent on the amount of
        time taken by the connect timeout. If the connection time has not been
        established, a :exc:`~urllib3.exceptions.TimeoutStateError` will be
        raised.

        :return: Value to use for the read timeout.
        :rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
        :raises urllib3.exceptions.TimeoutStateError: If :meth:`start_connect`
            has not yet been called on this object.
         N/A N/A N/A N/A self total None N/A N/A self total N/A self DEFAULT_TIMEOUT N/A N/A self _read None N/A N/A self _read N/A self DEFAULT_TIMEOUT N/A N/A N/A N/A self _start_connect None N/A N/A N/A self _read N/A N/A max 0 N/A min N/A N/A self total N/A N/A self get_connect_duration N/A self _read N/A N/A N/A N/A N/A self total None N/A N/A self total N/A self DEFAULT_TIMEOUT N/A N/A N/A max 0 N/A N/A self total N/A N/A self get_connect_duration N/A N/A N/A self _read N/A property N/A