
    vKg+                        S SK JrJr  S SKr S SKJr  S SK	J
r
  S SK	Jr  S SK	Jr  S SK	Jr   S S	K	Jr  S S
K	Jr  S SK	JrJr  S SK	Jr  S SK	Jr  S SK	Jr  S SK	Jr  S SK	Jr  S SKJrJr  S SKJ r   \" \!" \SS5      5      \" S5      :  r" " S S5      r# " S S\ \#\5      r " S S\ \#\5      r " S S\ \#\5      r " S S\ \#\5      r " S  S!\ \#\5      rg! \ a	    S SKJr   Nf = f! \ a     Nf = f)"    )AnyDictN)parse)parse_version)ActionChains)FirefoxOptions)FirefoxProfile)Proxy)TouchActions)Chrome)ChromeOptionsDesiredCapabilities)Edge)EdgeOptions)Firefox)Remote)Safari)backendutils)InspectRequestsMixin__version__0z4.0.0c                      ^  \ rS rSrSrS\\\4   S\\\4   4S jrU 4S jr	\
S\\\4   4S j5       r\R                  S\\\4   4S	 j5       rS
rU =r$ )DriverCommonMixin"   z)Attributes common to all webdriver types.seleniumwire_optionsreturnc                 T   [         R                  " UR                  SS5      UR                  SS5      US9U l         [        R
                  " U R                   R                  5       5      u  p#SSSR                  X#5      SR                  X#5      S	.0nS
U;   a  US
   US   S'   SUS'   U$ )zNCreate the backend proxy server and return its configuration
in a dictionary.
addrz	127.0.0.1portr   )r   r    optionsproxymanualz{}:{})	proxyType	httpProxysslProxyexclude_hostsnoProxyTacceptInsecureCerts)r   createpopgetr   urlsafe_addressaddressformat)selfr   r   r    configs        V/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/seleniumwire/webdriver.py_setup_backend DriverCommonMixin._setup_backend%   s     ~~%))&+>%))&!4(
 **4<<+?+?+AB
 %$^^D7#NN46
 22)=o)NF7OI&(,$%    c                 V   > U R                   R                  5         [        TU ]  5         g)z3Shutdown Selenium Wire and then quit the webdriver.N)r   shutdownsuperquit)r0   	__class__s    r2   r9   DriverCommonMixin.quitA   s    r5   c                 r   0 n[        U R                  R                  R                  S5      nU(       a  UR	                  S5      (       as  UR                  S5      S   nUR                  S5      tpE[        U R                  R                  R                  S5      nU(       a  U SU SUS    3X'   OU SUS    3X'   [        U R                  R                  R                  S	5      nU(       a  S
R                  U5      US	'   [        U R                  R                  R                  S5      nU(       a  XS'   U$ )z+Get the proxy configuration for the driver.modeupstreamz	upstream:   z://upstream_auth@r   no_proxy,upstream_custom_authcustom_authorization)getattrr   masterr!   
startswithsplitjoin)	r0   confr=   r>   schemerestauthrB   custom_auths	            r2   r"   DriverCommonMixin.proxyF   s
    t||**22F;DOOJ//zz+.q1H$NN51MF4<<..66HD"(TF!DG9="(T!WI64<<..66
C"xx1Ddll1199;QR+6'(r5   
proxy_confc                 X   U R                   R                  R                  nU(       a=  UR                  " S0 [        R
                  " [        R                  " SU05      5      D6  gUR                  " S0 [        R                  UR                  [        R                  5      [        R                  UR                  [        R                  5      [        R                  UR                  [        R                  5      [        R                  UR                  [        R                  5      0D6  g)zSet the proxy configuration for the driver.

The configuration should be a dictionary:

webdriver.proxy = {
    'https': 'https://user:pass@server:port',
    'no_proxy': 'localhost,127.0.0.1',
}

Args:
    proxy_conf: The proxy configuration.
r"   N )r   rG   r!   updater   build_proxy_argsget_upstream_proxy	MITM_MODEdefaultMITM_UPSTREAM_AUTHMITM_UPSTREAM_CUSTOM_AUTHMITM_NO_PROXY)r0   rQ   r!   s      r2   r"   rP   d   s     ,,%%--NNeU33E4L4LgWaMb4cdeNN OOW__U__%E,,gooe>V>V.W33W__UEdEd5e''9L9L)M	r5   )r   )__name__
__module____qualname____firstlineno____doc__r   strr   r3   r9   propertyr"   setter__static_attributes____classcell__r:   s   @r2   r   r   "   sy    34S> d3PS8n 8
 tCH~  : \\S#X  r5   r   c                   4   ^  \ rS rSrSrSS.U 4S jjrSrU =r$ )r      zSExtend the Firefox webdriver to provide additional methods for inspecting requests.Nr   c                V  > Uc  0 n US   nUR                  SS5        SUl        U R	                  U5      nUR                  SS5      (       a  [        (       a9  [        5       nUS   S   Ul        US   S   Ul	         US   S	   Ul
        Xdl        OYUR                  S
UR                  S5      5      nUc  [        R                  nUR                  5       nUR                  U5        XsS
'   [         TU ]D  " U0 UD6  g! [          a    [        5       nXCS'    GN
f = f! [          a     Nf = f)sInitialise a new Firefox WebDriver instance.

Args:
    seleniumwire_options: The seleniumwire options dictionary.
Nr!   z'network.proxy.allow_hijacking_localhostTauto_configr"   r%   r&   r(   capabilitiesdesired_capabilities)KeyErrorr   set_preferenceaccept_insecure_certsr3   r,   SELENIUM_V4r
   
http_proxy	ssl_proxyrB   r"   r   FIREFOXcopyrT   r8   __init__)	r0   r   argskwargsfirefox_optionsr1   r"   rm   r:   s	           r2   rw   Firefox.__init__   sD     '#% 	0$Y/O 	&&'PRVW04-$$%9:##M488{ #)'?;#? "(/*"=%+G_Y%?EN ).%  &zz.&**E[:\]'#6#>#>L+002##F+)5~&$)&)I  	0,.O /9	0,   s#   C< >D <DD
D('D(rS   r\   r]   r^   r_   r`   rw   rd   re   rf   s   @r2   r   r      s    ]37 /* /*r5   r   c                   4   ^  \ rS rSrSrSS.U 4S jjrSrU =r$ )r      zRExtend the Chrome webdriver to provide additional methods for inspecting requests.Nri   c                  > Uc  0 n UR                  SS5      =(       d    US   nUR                  S5        XCS'   U R	                  U5      nUR                  SS5      (       a+   UR                  5        H  u  pgUR                  Xg5        M     [        T	U ]<  " U0 UD6  g! [         a    [        5       n Nf = f! [         aB    UR                  S[        R                  R                  5       5      nUR                  U5         Nvf = f)zrInitialise a new Chrome WebDriver instance.

Args:
    seleniumwire_options: The seleniumwire options dictionary.
Nchrome_optionsr!   --proxy-bypass-list=<-loopback>rl   Trn   )r+   ro   r   add_argumentr3   r,   itemsset_capabilityAttributeError
setdefaultr   CHROMErv   rT   r8   rw   )
r0   r   rx   ry   r   r1   keyvaluecapsr:   s
            r2   rw   Chrome.__init__   s     '#% 	- $ZZ(8$?T6)CTN 	##$EF*y$$%9:##M488$"(,,.JC"11#= #1 	$)&))  	-*_N	- " $ (()?ATA[A[A`A`AbcF#	$$   B $*B9 B65B69A	DDrS   r|   rf   s   @r2   r   r      s    \37 !* !*r5   r   c                   0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r      zRExtend the Safari webdriver to provide additional methods for inspecting requests.c                 l   > Uc  0 nSU;   d   S5       eU R                  U5        [        TU ]  " U0 UD6  g)zrInitialise a new Safari WebDriver instance.

Args:
    seleniumwire_options: The seleniumwire options dictionary.
Nr    z6You must set a port number in the seleniumwire_options)r3   r8   rw   )r0   r   rx   ry   r:   s       r2   rw   Safari.__init__   sI      '#%  --g/gg-01$)&)r5   rS   Nr|   rf   s   @r2   r   r      s    \* *r5   r   c                   0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r      zPExtend the Edge webdriver to provide additional methods for inspecting requests.c                   > Uc  0 n UR                  SS5      =(       d    US   nUR                  S5        XCS'   U R	                  U5      nUR                  SS5      (       a+   UR                  5        H  u  pgUR                  Xg5        M     [        T	U ]<  " U0 UD6  g! [         a    [        5       n Nf = f! [         aB    UR                  S[        R                  R                  5       5      nUR                  U5         Nvf = f)zpInitialise a new Edge WebDriver instance.

Args:
    seleniumwire_options: The seleniumwire options dictionary.
Nedge_optionsr!   r   rl   Trn   )r+   ro   r   r   r3   r,   r   r   r   r   r   r   rv   rT   r8   rw   )
r0   r   rx   ry   r   r1   r   r   r   r:   s
            r2   rw   Edge.__init__   s     '#% 	) "::nd;Pvi?PL 	!!"CD(y$$%9:##M488$"(,,.JC //; #1 	$)&))  	)&=L	) " $ (()?ATA[A[A`A`AbcF#	$r   rS   r   r|   rf   s   @r2   r   r      s    Z!* !*r5   r   c                   4   ^  \ rS rSrSrSS.U 4S jjrSrU =r$ )r   i  zRExtend the Remote webdriver to provide additional methods for inspecting requests.Nri   c                0  > Uc  0 nU R                  U5      nUR                  SS5      (       aX  UR                  S5      nUc  [        R                  R	                  5       nOUR	                  5       nUR                  U5        XSS'   [        TU ]  " U0 UD6  g)rk   Nrl   Trn   )r3   r,   r   ru   rv   rT   r8   rw   )r0   r   rx   ry   r1   rm   r:   s         r2   rw   Remote.__init__  s      '#% $$%9:##M488!::&<=L#2::??A+002'-9)*$)&)r5   rS   r|   rf   s   @r2   r   r     s    \37 * *r5   r   )$typingr   r   seleniumpackaging.versionr   r   ImportErrorpkg_resourcesselenium.webdriverr   r   r	   r
   r   r   _Chromer   r   r   _Edger   r   _Firefoxr   _Remoter   _Safariseleniumwirer   r   seleniumwire.inspectr   rF   rr   r   rS   r5   r2   <module>r      s     ,8 , - - $	/ 1 A , * 2 0 0 ' 5GHmSABmT[F\\\ \~2*"$5x 2*j$*!#4g $*N*!#4g *.$*!2E $*N*!#4g *i  ,+,  		s"   C C$ C! C!$C-,C-