Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/requests_toolbelt/adapters/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/requests_toolbelt/adapters/socket_options.pyo
�
ӵ Yc@s�dZddlZddlZddlZddlmZddlmZddlmZddlm	Z
dejfd	��YZd
efd��YZ
dS(s/The implementation of the SocketOptionsAdapter.i����N(tadaptersi(t
connection(tpoolmanager(t
exceptionstSocketOptionsAdaptercBsreZdZedk	rBeejdejej	dfg�Z
ngZ
eje
jd�d�Zed�ZRS(sdAn adapter for requests that allows users to specify socket options.

    Since version 2.4.0 of requests, it is possible to specify a custom list
    of socket options that need to be set before establishing the connection.

    Example usage::

        >>> import socket
        >>> import requests
        >>> from requests_toolbelt.adapters import socket_options
        >>> s = requests.Session()
        >>> opts = [(socket.IPPROTO_TCP, socket.TCP_NODELAY, 0)]
        >>> adapter = socket_options.SocketOptionsAdapter(socket_options=opts)
        >>> s.mount('http://', adapter)

    You can also take advantage of the list of default options on this class
    to keep using the original options in addition to your custom options. In
    that case, ``opts`` might look like::

        >>> opts = socket_options.SocketOptionsAdapter.default_options + opts

    tdefault_socket_optionsis�This version of Requests is only compatible with a version of urllib3 which is too old to support setting options on a socket. This adapter is functionally useless.cKs2|jd|j�|_tt|�j|�dS(Ntsocket_options(tpoptdefault_optionsRtsuperRt__init__(tselftkwargs((sM/usr/lib/python2.7/site-packages/requests_toolbelt/adapters/socket_options.pyR
4s	c	Cs\tjdkr<tjd|d|d|d|j�|_ntt|�j|||�dS(Nit	num_poolstmaxsizetblockR(trequestst	__build__RtPoolManagerRR	Rtinit_poolmanager(RtconnectionsRR((sM/usr/lib/python2.7/site-packages/requests_toolbelt/adapters/socket_options.pyR:s	N(t__name__t
__module__t__doc__RtNonetgetattrtHTTPConnectiontsockettIPPROTO_TCPtTCP_NODELAYRtwarningstwarntexctRequestsVersionTooOldR
tFalseR(((sM/usr/lib/python2.7/site-packages/requests_toolbelt/adapters/socket_options.pyRs	tTCPKeepAliveAdaptercBseZdZd�ZRS(sJAn adapter for requests that turns on TCP Keep-Alive by default.

    The adapter sets 4 socket options:

    - ``SOL_SOCKET`` ``SO_KEEPALIVE`` - This turns on TCP Keep-Alive
    - ``IPPROTO_TCP`` ``TCP_KEEPINTVL`` 20 - Sets the keep alive interval
    - ``IPPROTO_TCP`` ``TCP_KEEPCNT`` 5 - Sets the number of keep alive probes
    - ``IPPROTO_TCP`` ``TCP_KEEPIDLE`` 60 - Sets the keep alive time if the
      socket library has the ``TCP_KEEPIDLE`` constant

    The latter three can be overridden by keyword arguments (respectively):

    - ``idle``
    - ``interval``
    - ``count``

    You can use this adapter like so::

       >>> from requests_toolbelt.adapters import socket_options
       >>> tcp = socket_options.TCPKeepAliveAdapter(idle=120, interval=10)
       >>> s = requests.Session()
       >>> s.mount('http://', tcp)

    cKs�|jdtj�}|jdd�}|jdd�}|jdd�}|tjtjdftjtj|ftjtj|fg}t	td	d�dk	r�|tjtj|fg7}ntt
|�jd||�dS(
NRtidlei<tintervalitcountiitTCP_KEEPIDLE(RRRRt
SOL_SOCKETtSO_KEEPALIVERt
TCP_KEEPINTVLtTCP_KEEPCNTRRR'R	R#R
(RRRR$R%R&((sM/usr/lib/python2.7/site-packages/requests_toolbelt/adapters/socket_options.pyR
cs	(RRRR
(((sM/usr/lib/python2.7/site-packages/requests_toolbelt/adapters/socket_options.pyR#Is(RRRRRt_compatRRtRR tHTTPAdapterRR#(((sM/usr/lib/python2.7/site-packages/requests_toolbelt/adapters/socket_options.pyt<module>s;

Spamworldpro Mini