
    g(                         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mZ d dl	Z	d dl
mZ d dl
mZ  G d de      Z G d	 d
      Zy)    N)Enum)Optional)parse)Proxy)	ProxyTypec                       e Zd ZdZdZdZy)AuthTypeBasicBearerz	X-API-KeyN)__name__
__module____qualname__BASICBEARER	X_API_KEY     Z/var/www/html/venv/lib/python3.12/site-packages/selenium/webdriver/remote/client_config.pyr	   r	      s    EFIr   r	   c                      e Zd Zd edej
                  i      ddddddej                  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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d3d"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edefd/       Zej                   deddfd0       Zde	e   fd1Zde	e   fd2Zy)4ClientConfigT	proxyType)rawFNremote_server_addr
keep_aliveproxyignore_certificatesinit_args_for_pool_managertimeoutca_certsusernamepassword	auth_typetoken
user_agentextra_headers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#   r$   r%   osgetenvfloatstrsocketgetdefaulttimeoutenvironcertifiwherer   )selfr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   s                 r   __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 	  	r   c                     | j                   S )z+:Returns: The address of the remote server._remote_server_addrr3   s    r   r   zClientConfig.remote_server_addrR   s     '''r   valuec                     || _         y)z*Provides the address of the remote server.Nr6   r3   r9   s     r   r   zClientConfig.remote_server_addrW   s     $) r   c                     | j                   S )z:Returns: The keep alive value._keep_aliver8   s    r   r   zClientConfig.keep_alive\        r   c                     || _         y)zrToggles the keep alive value.

        :Args:
         - value: whether to keep the http connection alive
        Nr=   r;   s     r   r   zClientConfig.keep_alivea   s     !r   c                     | j                   S )z@:Returns: The proxy used for communicating to the driver/server._proxyr8   s    r   r   zClientConfig.proxyj        {{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
        NrB   )r3   r   s     r   r   zClientConfig.proxyo   s     r   c                     | j                   S )z-:Returns: The ignore certificate check value._ignore_certificatesr8   s    r   r   z ClientConfig.ignore_certificatesz   s     (((r   c                     || _         y)zrToggles the ignore certificate check.

        :Args:
         - value: value of ignore certificate check
        NrG   )r3   r   s     r   r   z ClientConfig.ignore_certificates   s     %8!r   c                     | j                   S )zc:Returns: The dictionary of arguments will be appended while
        initializing the pool manager._init_args_for_pool_managerr8   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
        NrK   )r3   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._timeoutr8   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
        NrO   )r3   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/   rP   r8   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_certsr8   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
        NrU   )r3   r   s     r   r   zClientConfig.ca_certs   s     "r   c                     | j                   S )zPReturns the username used for basic authentication to the remote
        server.	_usernamer8   s    r   r    zClientConfig.username        ~~r   c                     || _         y)zMSets the username used for basic authentication to the remote
        server.NrY   r;   s     r   r    zClientConfig.username        r   c                     | j                   S )zPReturns the password used for basic authentication to the remote
        server.	_passwordr8   s    r   r!   zClientConfig.password   r[   r   c                     || _         y)zMSets the password used for basic authentication to the remote
        server.Nr_   r;   s     r   r!   zClientConfig.password   r]   r   c                     | j                   S )z8Returns the type of authentication to the remote server.
_auth_typer8   s    r   r"   zClientConfig.auth_type   s     r   c                     || _         y)zSets the type of authentication to the remote server if it is not
        using basic with username and password.

        :Args: value - AuthType enum value. For others, please use `extra_headers` instead
        Nrc   r;   s     r   r"   zClientConfig.auth_type   s      r   c                     | j                   S )z?Returns the token used for authentication to the remote server._tokenr8   s    r   r#   zClientConfig.token   rD   r   c                     || _         y)z^Sets the token used for authentication to the remote server if
        auth_type is not basic.Nrg   r;   s     r   r#   zClientConfig.token   s     r   c                     | j                   S )z6Returns user agent to be added to the request headers._user_agentr8   s    r   r$   zClientConfig.user_agent   r?   r   c                     || _         y)z3Sets user agent to be added to the request headers.Nrk   r;   s     r   r$   zClientConfig.user_agent   s     !r   c                     | j                   S )z1Returns extra headers to be added to the request._extra_headersr8   s    r   r%   zClientConfig.extra_headers   s     """r   c                     || _         y)z.Sets extra headers to be added to the request.Nro   r;   s     r   r%   zClientConfig.extra_headers   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*   r0   getmapr-   stripsplitnetlocpath
startswithMANUALsslProxyrx   )r3   r{   
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                   t        j                  u r| j                  r{| j                  ro| j                   d| j                   }t        j                  |j                  d            j                  d      }dt        j                  j                   d| iS | j                   t        j                  u r7| j                  r+dt        j                  j                   d| j                   iS | j                   t        j                  u r4| j                  r(t        j                  j                   | j                   iS y)z8Returns the authorization to add to the request headers.:zutf-8Authorization N)r"   r	   r   r    r!   base64	b64encodeencodedecoder9   r   r#   r   )r3   credentialsencoded_credentialss      r   get_auth_headerzClientConfig.get_auth_header  s    >>X^^+$--!]]O1T]]O<K"("2"2;3E3Eg3N"O"V"VW^"_#(<(<'=Q?R>S%TUU>>X__,#(=(='>a

|%LMM>>X///DJJ))//0djj\CCr   )r&   N) r   r   r   r   r   r~   r	   r   r-   r   booldictintr4   propertyr   setterr   r   r   r   r   rS   r   r    r!   r"   r#   r$   r%   r   r   r   r   r   r   r   $   s    &*!&K9I9I+J!K.359!%"&"&"&(0#$((,+
+
 TN+
 	+

 &d^+
 %-TN+
 #+
 3-+
 3-+
 3-+
 H%+
 }+
 SM+
  ~+
 
+
Z (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  
 8    x  D     s   \\3 4  
  C     ! ! ! ! #t # # $4 $D $ $x} 2
$ 
r   r   )r   r*   r.   enumr   typingr   urllibr   r1   selenium.webdriver.common.proxyr   r   r	   r   r   r   r   <module>r      s:   "  	      1 5t  r   