§
    sŠtj0
  ã                   óB   — d Z ddlmZ ddlmZmZ  G d„ de¦  «        ZdS )zº
requests_toolbelt.source_adapter
================================

This file contains an implementation of the SourceAddressAdapter originally
demonstrated on the Requests GitHub page.
é    )ÚHTTPAdapteré   )ÚpoolmanagerÚ
basestringc                   ó4   ‡ — e Zd ZdZˆ fd„Zdd„Zˆ fd„Zˆ xZS )ÚSourceAddressAdaptera:  
    A Source Address Adapter for Python Requests that enables you to choose the
    local address to bind to. This allows you to send your HTTP requests from a
    specific interface and IP address.

    Two address formats are accepted. The first is a string: this will set the
    local IP address to the address given in the string, and will also choose a
    semi-random high port for the local port number.

    The second is a two-tuple of the form (ip address, port): for example,
    ``('10.10.10.10', 8999)``. This will set the local IP address to the first
    element, and the local port to the second element. If ``0`` is used as the
    port number, a semi-random high port will be selected.

    .. warning:: Setting an explicit local port can have negative interactions
                 with connection-pooling in Requests: in particular, it risks
                 the possibility of getting "Address in use" errors. The
                 string-only argument is generally preferred to the tuple-form.

    Example usage:

    .. code-block:: python

        import requests
        from requests_toolbelt.adapters.source import SourceAddressAdapter

        s = requests.Session()
        s.mount('http://', SourceAddressAdapter('10.10.10.10'))
        s.mount('https://', SourceAddressAdapter(('10.10.10.10', 8999)))
    c                 óÞ   •— t          |t          ¦  «        r
|df| _        n,t          |t          ¦  «        r|| _        nt	          d¦  «        ‚ t          t          | ¦  «        j        di |¤Ž d S )Nr   z<source_address must be IP address string or (ip, port) tuple© )Ú
isinstancer   Úsource_addressÚtupleÚ	TypeErrorÚsuperr   Ú__init__)Úselfr   ÚkwargsÚ	__class__s      €ú_/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/requests_toolbelt/adapters/source.pyr   zSourceAddressAdapter.__init__-   sƒ   ø€ Ý�n¥jÑ1Ô1ð 	Ø#1°1Ð"5ˆDÔÐÝ˜­Ñ.Ô.ð 	Ø"0ˆDÔÐåØNñô ð ð 	3�Õ" DÑ)Ô)Ô2Ð<Ð<°VÐ<Ð<Ð<Ð<Ð<ó    Fc                 óJ   — t          j        |||| j        ¬¦  «        | _         d S )N)Ú	num_poolsÚmaxsizeÚblockr   )r   ÚPoolManagerr   )r   Úconnectionsr   r   s       r   Úinit_poolmanagerz%SourceAddressAdapter.init_poolmanager9   s1   € Ý&Ô2Ø!ØØØÔ.ð	0ñ 0ô 0ˆÔÐÐr   c                 óX   •— | j         |d<    t          t          | ¦  «        j        |i |¤ŽS )Nr   )r   r   r   Úproxy_manager_for)r   Úargsr   r   s      €r   r   z&SourceAddressAdapter.proxy_manager_for@   s>   ø€ Ø#'Ô#6ˆÐÑ ØB�uÕ)¨4Ñ0Ô0ÔBØðØðð ð 	r   )F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Ú__classcell__)r   s   @r   r   r      so   ø€ € € € € ðð ð<
=ð 
=ð 
=ð 
=ð 
=ð0ð 0ð 0ð 0ðð ð ð ð ð ð ð ð r   r   N)r#   Úrequests.adaptersr   Ú_compatr   r   r   r
   r   r   ú<module>r'      so   ððð ð *Ð )Ð )Ð )Ð )Ð )à -Ð -Ð -Ð -Ð -Ð -Ð -Ð -ð5ð 5ð 5ð 5ð 5˜;ñ 5ô 5ð 5ð 5ð 5r   