
    <g$                     h    d dl Z d dlZd dlZd dlmZ d dlmZ d dlZd dlm	Z	 d dlm
Z
  G d d      Zy)    N)Optional)parse)Proxy)	ProxyTypec                      e Zd Zd edej
                  i      ddddddddf
dedee   d	ee   d
ee   dee	   dee
   dee   dee   dee   dee   dee   ddfdZedefd       Zej                  deddfd       Zedefd       Zej                  deddfd       Zedefd       Zej                  d	eddfd       Zedefd       Zej                  d
eddfd       Zede	fd       Zej                  de	ddfd       Zede
fd       Zej                  de
ddfd        Zd.d!Zedefd"       Zej                  deddfd#       Zedefd$       Zej                  deddfd%       Zedefd&       Zej                  deddfd'       Zedefd(       Zej                  deddfd)       Zedefd*       Zej                  deddfd+       Zdee   fd,Zdee	   fd-Zy)/ClientConfigT	proxyType)rawFNBasicremote_server_addr
keep_aliveproxyignore_certificatesinit_args_for_pool_managertimeoutca_certsusernamepassword	auth_typetokenreturnc           	         || _         || _        || _        || _        |xs i | _        || _        || _        |	| _        |
| _        || _	        |ct        j                  d      :t        t        j                  dt        t        j                                           nt        j                         n|| _        |Gdt        j                   v rt        j                  d      | _        y t#        j$                         | _        y || _        y )NGLOBAL_DEFAULT_TIMEOUTREQUESTS_CA_BUNDLE)r   r   r   r   r   r   r   r   r   r   osgetenvfloatstrsocketgetdefaulttimeoutenvironcertifiwherer   )selfr   r   r   r   r   r   r   r   r   r   r   s               [/var/www/html/myenv/lib/python3.12/site-packages/selenium/webdriver/remote/client_config.py__init__zClientConfig.__init__   s     #5$
#6 *D*J'  "
  9956B bii 8#f>V>V>X:YZ[--/  	  1E

0RRYY+, 	X_XeXeXg 	  	    c                     | j                   S )z+:Returns: The address of the remote server._remote_server_addrr$   s    r%   r   zClientConfig.remote_server_addrG   s     '''r'   valuec                     || _         y)z*Provides the address of the remote server.Nr)   r$   r,   s     r%   r   zClientConfig.remote_server_addrL   s     $) r'   c                     | j                   S )z:Returns: The keep alive value._keep_aliver+   s    r%   r   zClientConfig.keep_aliveQ   s     r'   c                     || _         y)zrToggles the keep alive value.

        :Args:
         - value: whether to keep the http connection alive
        Nr0   r.   s     r%   r   zClientConfig.keep_aliveV   s     !r'   c                     | j                   S )z@:Returns: The proxy used for communicating to the driver/server._proxyr+   s    r%   r   zClientConfig.proxy_        {{r'   c                     || _         y)zProvides the information for communicating with the driver or
        server.
        For example: Proxy(raw={"proxyType": ProxyType.SYSTEM})

        :Args:
         - value: the proxy information to use to communicate with the driver or server
        Nr4   )r$   r   s     r%   r   zClientConfig.proxyd   s     r'   c                     | j                   S )z-:Returns: The ignore certificate check value._ignore_certificatesr+   s    r%   r   z ClientConfig.ignore_certificateso   s     (((r'   c                     || _         y)zrToggles the ignore certificate check.

        :Args:
         - value: value of ignore certificate check
        Nr9   )r$   r   s     r%   r   z ClientConfig.ignore_certificatest   s     %8!r'   c                     | j                   S )zc:Returns: The dictionary of arguments will be appended while
        initializing the pool manager._init_args_for_pool_managerr+   s    r%   r   z'ClientConfig.init_args_for_pool_manager}   s     ///r'   c                     || _         y)a%  Provides dictionary of arguments will be appended while initializing the pool manager.
        For example: {"init_args_for_pool_manager": {"retries": 3, "block": True}}

        :Args:
         - value: the dictionary of arguments will be appended while initializing the pool manager
        Nr=   )r$   r   s     r%   r   z'ClientConfig.init_args_for_pool_manager   s     ,F(r'   c                     | j                   S )zW:Returns: The timeout (in seconds) used for communicating to the
        driver/server._timeoutr+   s    r%   r   zClientConfig.timeout   s     }}r'   c                     || _         y)zProvides the timeout (in seconds) for communicating with the driver
        or server.

        :Args:
         - value: the timeout (in seconds) to use to communicate with the driver or server
        NrA   )r$   r   s     r%   r   zClientConfig.timeout   s      r'   c                 6    t        j                         | _        y)z2Resets the timeout to the default value of socket.N)r   r    rB   r+   s    r%   reset_timeoutzClientConfig.reset_timeout   s    002r'   c                     | j                   S )z0:Returns: The path to bundle of CA certificates.	_ca_certsr+   s    r%   r   zClientConfig.ca_certs   s     ~~r'   c                     || _         y)zProvides the path to bundle of CA certificates for establishing
        secure connections.

        :Args:
         - value: the path to bundle of CA certificates for establishing secure connections
        NrG   )r$   r   s     r%   r   zClientConfig.ca_certs   s     "r'   c                     | j                   S )zPReturns the username used for basic authentication to the remote
        server.	_usernamer+   s    r%   r   zClientConfig.username        ~~r'   c                     || _         y)zMSets the username used for basic authentication to the remote
        server.NrK   r.   s     r%   r   zClientConfig.username        r'   c                     | j                   S )zPReturns the password used for basic authentication to the remote
        server.	_passwordr+   s    r%   r   zClientConfig.password   rM   r'   c                     || _         y)zMSets the password used for basic authentication to the remote
        server.NrQ   r.   s     r%   r   zClientConfig.password   rO   r'   c                     | j                   S )z8Returns the type of authentication to the remote server.
_auth_typer+   s    r%   r   zClientConfig.auth_type   s     r'   c                     || _         y)zqSets the type of authentication to the remote server if it is not
        using basic with username and password.NrU   r.   s     r%   r   zClientConfig.auth_type   s      r'   c                     | j                   S )z?Returns the token used for authentication to the remote server._tokenr+   s    r%   r   zClientConfig.token   r6   r'   c                     || _         y)z^Sets the token used for authentication to the remote server if
        auth_type is not basic.NrY   r.   s     r%   r   zClientConfig.token   s     r'   c                    | j                   j                  }t        j                  | j                        }|t
        j                  u ry|t
        j                  u rIt        j                  j                  dt        j                  j                  d            }|rt        t        j                  |j                  d            D ]_  }|dk(  r yt        j                  |      }|j                  r|j                  |j                  k(  r y|j                   |j                  v s_ y t        j                  j                  | j                  j#                  d      rdndt        j                  j                  | j                  j#                  d      r
d	            S d
            S |t
        j$                  u rG| j                  j#                  d      r| j                   j&                  S | j                   j(                  S y)z0Returns the proxy URL to use for the connection.Nno_proxyNO_PROXY,*zhttps://https_proxy
http_proxyHTTPS_PROXY
HTTP_PROXY)r   
proxy_typer   urlparser   r   DIRECTSYSTEMr   r!   getmapr   stripsplitnetlocpath
startswithMANUALsslProxyrb   )r$   re   
remote_add	_no_proxyentryn_urls         r%   get_proxy_urlzClientConfig.get_proxy_url   s   ZZ**
^^D$;$;<
))))))

z2::>>*3MNI IOOC,@A $E|#!NN51E||
(9(9U\\(I#zzZ%6%66#$ ::>>!%!8!8!C!CJ!OUa

0G0G0R0RS]0^}q dpq  )))*.*A*A*L*LZ*X4::&&s^b^h^h^s^ssr'   c                    | j                   j                         }|dk(  rm| j                  ra| j                  rU| j                   d| j                   }t	        j
                  |j                  d            j                  d      }dd| iS |dk(  r| j                  rdd| j                   iS |dk(  r| j                  rdd	| j                   iS y
)z8Returns the authorization to add to the request headers.basic:zutf-8AuthorizationzBasic bearerzBearer oauthzOAuth N)	r   lowerr   r   base64	b64encodeencodedecoder   )r$   r   credentialsencoded_credentialss       r%   get_auth_headerzClientConfig.get_auth_header   s    NN((*	DMMdmm!]]O1T]]O<K"("2"2;3E3Eg3N"O"V"VW^"_#v.A-B%CDD TZZ#wtzzl%;<<DJJ#vdjj\%:;;r'   )r   N)__name__
__module____qualname__r   r   rh   r   r   booldictintr&   propertyr   setterr   r   r   r   r   rE   r   r   r   r   r   rv   r    r'   r%   r   r      s    &*!&K9I9I+J!K.359!%"&"&"&#*#'
'
 TN'
 	'

 &d^'
 %-TN'
 #'
 3-'
 3-'
 3-'
 C='
 }'
 
'
R (C ( ( ) ) ) )  D     ! ! ! ! u   \\5 T   )T ) ) 8t 8 8  8 0D 0 0
  &&FT Fd F 'F   
 ^^ s  t    3 #   __" " " " #  
 __c d  
 #  
 __c d  
 3    s  t    
 s   \\3 4  
x} 2$ r'   r   )r~   r   r   typingr   urllibr   r"   selenium.webdriver.common.proxyr   r   r   r   r'   r%   <module>r      s+   "  	     1 5e er'   