
    ,h}M                    j   d dl mZ ddlmZmZ d dlmZ d dlZd dlZddl	m
Z
 ddl	mZ ddl	mZ  G d	 d
e      Z G d dej                        Ze G d d             Ze G d d             Ze G d d             Ze G d d             Zd$dZ	 	 d%	 	 	 	 	 d&dZ	 	 	 	 	 	 d'dZ	 	 	 	 d(	 	 	 	 	 	 	 	 	 	 	 	 	 d)dZ	 	 	 	 	 d*	 	 	 	 	 	 	 	 	 	 	 	 	 d+dZ	 	 	 	 	 	 d,dZ	 	 	 	 d(	 	 	 	 	 	 	 	 	 	 	 d-dZ	 	 	 	 d.dZ	 	 	 	 d/dZ ed      e G d d                     Z ed!      e G d" d#                    Zy)0    )annotations   )event_classT_JSON_DICT)	dataclassN)io)network)pagec                  <     e Zd ZdZddZedd       Z fdZ xZS )	RequestIdz
    Unique request identifier.
    Note that this does not identify individual HTTP requests that are part of
    a network request.
    c                    | S N selfs    o/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/selenium/webdriver/common/devtools/v135/fetch.pyto_jsonzRequestId.to_json   s        c                     | |      S r   r   clsjsons     r   	from_jsonzRequestId.from_json       4yr   c                >    dj                  t        | 	               S )NzRequestId({}))formatsuper__repr__)r   	__class__s    r   r   zRequestId.__repr__   s    %%eg&6&899r   )returnstr)r   r!   r    r   )	__name__
__module____qualname____doc__r   classmethodr   r   __classcell__)r   s   @r   r   r      s+    
  : :r   r   c                  .    e Zd ZdZdZdZd Zed        Zy)RequestStagez
    Stages of the request to handle. Request will intercept before the request is
    sent. Response will intercept after the response is received (but before response
    body is received).
    RequestResponsec                    | j                   S r   )valuer   s    r   r   zRequestStage.to_json+   s    zzr   c                     | |      S r   r   r   s     r   r   zRequestStage.from_json.   r   r   N)	r"   r#   r$   r%   REQUESTRESPONSEr   r&   r   r   r   r   r)   r)   "   s,    
 GH  r   r)   c                  N    e Zd ZU dZded<   dZded<   dZded<   d Zed	        Z	y)
RequestPatternNtyping.Optional[str]url_patternz%typing.Optional[network.ResourceType]resource_typeztyping.Optional[RequestStage]request_stagec                    t               }| j                  | j                  |d<   | j                  | j                  j                         |d<   | j                  | j                  j                         |d<   |S )N
urlPatternresourceTyperequestStage)dictr4   r5   r   r6   r   r   s     r   r   zRequestPattern.to_json?   st    v'!%!1!1D)#'#5#5#=#=#?D )#'#5#5#=#=#?D r   c                     | d|v rt        |d         nd d|v r"t        j                  j                  |d         nd d|v rt        j                  |d               S d       S )Nr8   r9   r:   )r4   r5   r6   )r!   r	   ResourceTyper   r)   r   s     r   r   zRequestPattern.from_jsonI   su    3?43GD./TR`dhRh'..88n9MNnrJX\`J`,00n1EF
 	
 gk
 	
r   )
r"   r#   r$   r4   __annotations__r5   r6   r   r&   r   r   r   r   r2   r2   3   sC     )-K%, <@M8? 48M07 
 
r   r2   c                  <    e Zd ZU dZded<   ded<   d Zed        Zy)HeaderEntryz$
    Response HTTP header entry
    r!   namer-   c                V    t               }| j                  |d<   | j                  |d<   |S )NrB   r-   )r;   rB   r-   r<   s     r   r   zHeaderEntry.to_json[   s(    vyyV

Wr   c                F     | t        |d         t        |d               S )NrB   r-   )rB   r-   r!   r   s     r   r   zHeaderEntry.from_jsona   s'    T&\"d7m$
 	
r   N)r"   r#   r$   r%   r?   r   r&   r   r   r   r   rA   rA   R   s,     IJ 
 
r   rA   c                  T    e Zd ZU dZded<   ded<   ded<   dZded<   d	 Zed
        Zy)AuthChallengezB
    Authorization challenge for HTTP status code 401 or 407.
    r!   originschemerealmNr3   sourcec                    t               }| j                  |d<   | j                  |d<   | j                  |d<   | j                  | j                  |d<   |S )NrH   rI   rJ   rK   )r;   rH   rI   rJ   rK   r<   s     r   r   zAuthChallenge.to_jsonz   sL    vXX

W;;"![[DNr   c           	          | t        |d         t        |d         t        |d         d|v rt        |d               S d       S )NrH   rI   rJ   rK   )rH   rI   rJ   rK   rE   r   s     r   r   zAuthChallenge.from_json   sW    tH~&tH~&d7m$*2d*:3tH~&	
 	
 AE	
 	
r   )	r"   r#   r$   r%   r?   rK   r   r&   r   r   r   r   rG   rG   i   sB     K K J $(F ' 
 
r   rG   c                  N    e Zd ZU dZded<   dZded<   dZded<   d Zed	        Z	y)
AuthChallengeResponsez'
    Response to an AuthChallenge.
    r!   responseNr3   usernamepasswordc                    t               }| j                  |d<   | j                  | j                  |d<   | j                  | j                  |d<   |S )NrP   rQ   rR   )r;   rP   rQ   rR   r<   s     r   r   zAuthChallengeResponse.to_json   sL    v==Z==$#}}D==$#}}Dr   c                     | t        |d         d|v rt        |d         nd d|v rt        |d               S d       S )NrP   rQ   rR   )rP   rQ   rR   rE   r   s     r   r   zAuthChallengeResponse.from_json   sW    j)*.8D.@Sj)*d.8D.@Sj)*
 	
 GK
 	
r   )
r"   r#   r$   r%   r?   rQ   rR   r   r&   r   r   r   r   rO   rO      sA     M &*H") &*H") 
 
r   rO   c               #     K   ddi} | }yw)z$
    Disables the fetch domain.
    methodzFetch.disableNr   )cmd_dictr   s     r   disablerX      s     
 	/H >Ds   
c              #     K   t               }| !| D cg c]  }|j                          c}|d<   |||d<   d|d}|}yc c}w w)a  
    Enables issuing of requestPaused events. A request will be paused until client
    calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth.

    :param patterns: *(Optional)* If specified, only requests matching any of these patterns will produce fetchRequested event and will be paused until clients response. If not set, all requests will be affected.
    :param handle_auth_requests: *(Optional)* If true, authRequired events will be issued and requests will be paused expecting a call to continueWithAuth.
    NpatternshandleAuthRequestszFetch.enablerV   paramsr;   r   )rZ   handle_auth_requestsr]   irW   r   s         r   enablera      s\      &F3;<aaiik<z'';#$ H >D =s   AAAc              #  ~   K   t               }| j                         |d<   |j                         |d<   d|d}|}yw)z
    Causes the request to fail with specified reason.

    :param request_id: An id the client received in requestPaused event.
    :param error_reason: Causes the request to fail with the given reason.
    	requestIderrorReasonzFetch.failRequestr\   Nr^   )
request_iderror_reasonr]   rW   r   s        r   fail_requestrg      sK      &F$,,.F;(002F=%H >D   ;=c              #     K   t               }| j                         |d<   ||d<   |!|D cg c]  }|j                          c}|d<   |||d<   |||d<   |||d<   d|d	}|}	yc c}w w)
a`  
    Provides response to the request.

    :param request_id: An id the client received in requestPaused event.
    :param response_code: An HTTP response code.
    :param response_headers: *(Optional)* Response headers.
    :param binary_response_headers: *(Optional)* Alternative way of specifying response headers as a  -separated series of name: value pairs. Prefer the above method unless you need to represent some non-UTF8 values that can't be transmitted over the protocol as text.
    :param body: *(Optional)* A response body. If absent, original response body will be used if the request is intercepted at the response stage and empty body will be used if the request is intercepted at the request stage.
    :param response_phrase: *(Optional)* A textual representation of responseCode. If absent, a standard phrase matching responseCode is used.
    rc   responseCodeNresponseHeadersbinaryResponseHeadersbodyresponsePhrasezFetch.fulfillRequestr\   r^   )
re   response_coderesponse_headersbinary_response_headersrm   response_phraser]   r`   rW   r   s
             r   fulfill_requestrs      s     $ &F$,,.F;*F>#:J$KQQYY[$K !**A&'v"#2 (H >D %Ls   )A,A'*A,c              #     K   t               }| j                         |d<   |||d<   |||d<   |||d<   |!|D cg c]  }|j                          c}|d<   |||d<   d|d	}|}	yc c}w w)
a  
    Continues the request, optionally modifying some of its parameters.

    :param request_id: An id the client received in requestPaused event.
    :param url: *(Optional)* If set, the request url will be modified in a way that's not observable by page.
    :param method: *(Optional)* If set, the request method is overridden.
    :param post_data: *(Optional)* If set, overrides the post data in the request.
    :param headers: *(Optional)* If set, overrides the request headers. Note that the overrides do not extend to subsequent redirect hops, if a redirect happens. Another override may be applied to a different request produced by a redirect.
    :param intercept_response: **(EXPERIMENTAL)** *(Optional)* If set, overrides response interception behavior for this request.
    rc   NurlrV   postDataheadersinterceptResponsezFetch.continueRequestr\   r^   )
re   ru   rV   	post_datarw   intercept_responser]   r`   rW   r   s
             r   continue_requestr{   
  s     $ &F$,,.F;
u!x&z29:QQYY[:y%&8"#)H >D ;s   9A.A)A.c              #  ~   K   t               }| j                         |d<   |j                         |d<   d|d}|}yw)z
    Continues a request supplying authChallengeResponse following authRequired event.

    :param request_id: An id the client received in authRequired event.
    :param auth_challenge_response: Response to  with an authChallenge.
    rc   authChallengeResponsezFetch.continueWithAuthr\   Nr^   )re   auth_challenge_responser]   rW   r   s        r   continue_with_authr   /  sL      &F$,,.F;&=&E&E&GF"#*H >Drh   c              #     K   t               }| j                         |d<   |||d<   |||d<   |!|D cg c]  }|j                          c}|d<   |||d<   d|d}|}yc c}w w)	a  
    Continues loading of the paused response, optionally modifying the
    response headers. If either responseCode or headers are modified, all of them
    must be present.

    **EXPERIMENTAL**

    :param request_id: An id the client received in requestPaused event.
    :param response_code: *(Optional)* An HTTP response code. If absent, original response code will be used.
    :param response_phrase: *(Optional)* A textual representation of responseCode. If absent, a standard phrase matching responseCode is used.
    :param response_headers: *(Optional)* Response headers. If absent, original response headers will be used.
    :param binary_response_headers: *(Optional)* Alternative way of specifying response headers as a  -separated series of name: value pairs. Prefer the above method unless you need to represent some non-UTF8 values that can't be transmitted over the protocol as text.
    rc   Nrj   rn   rk   rl   zFetch.continueResponser\   r^   )	re   ro   rr   rp   rq   r]   r`   rW   r   s	            r   continue_responser   C  s     ( &F$,,.F; !.~"#2 #:J$KQQYY[$K !**A&'*H >D %Ls   2A'A"A'c              #     K   t               }| j                         |d<   d|d}|}t        |d         t        |d         fS w)a{  
    Causes the body of the response to be received from the server and
    returned as a single string. May only be issued for a request that
    is paused in the Response stage and is mutually exclusive with
    takeResponseBodyForInterceptionAsStream. Calling other methods that
    affect the request or disabling fetch domain before body is received
    results in an undefined behavior.
    Note that the response body is not available for redirects. Requests
    paused in the _redirect received_ state may be differentiated by
    ``responseCode`` and presence of ``location`` response header, see
    comments to ``requestPaused`` for details.

    :param request_id: Identifier for the intercepted request to get body for.
    :returns: A tuple with the following items:

        0. **body** - Response body.
        1. **base64Encoded** - True, if content was sent as base64.
    rc   zFetch.getResponseBodyr\   rm   base64Encoded)r;   r   r!   boolre   r]   rW   r   s       r   get_response_bodyr   h  s[     * &F$,,.F;)H >DDLT/"# s   AAc              #     K   t               }| j                         |d<   d|d}|}t        j                  j	                  |d         S w)ag  
    Returns a handle to the stream representing the response body.
    The request must be paused in the HeadersReceived stage.
    Note that after this command the request can't be continued
    as is -- client either needs to cancel it or to provide the
    response body.
    The stream only supports sequential read, IO.read will fail if the position
    is specified.
    This method is mutually exclusive with getResponseBody.
    Calling other methods that affect the request or disabling fetch
    domain before body is received results in an undefined behavior.

    :param request_id:
    :returns: 
    rc   zFetch.takeResponseBodyAsStreamr\   stream)r;   r   r   StreamHandler   r   s       r   take_response_body_as_streamr     sQ     $ &F$,,.F;2H >D??$$T(^44s   A	AzFetch.requestPausedc                      e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   ded<   ded<   ded<   ded<   ded<   edd       Zy)RequestPauseda%  
    Issued when the domain is enabled and the request URL matches the
    specified filter. The request is paused until the client responds
    with one of continueRequest, failRequest or fulfillRequest.
    The stage of the request can be determined by presence of responseErrorReason
    and responseStatusCode -- the request is at the response stage if either
    of these fields is present and in the request stage otherwise.
    Redirect responses and subsequent requests are reported similarly to regular
    responses and requests. Redirect responses may be distinguished by the value
    of ``responseStatusCode`` (which is one of 301, 302, 303, 307, 308) along with
    presence of the ``location`` header. Requests resulting from a redirect will
    have ``redirectedRequestId`` field set.
    r   re   network.Requestrequestpage.FrameIdframe_idnetwork.ResourceTyper5   z$typing.Optional[network.ErrorReason]response_error_reasontyping.Optional[int]response_status_coder3   response_status_text)typing.Optional[typing.List[HeaderEntry]]rp   z"typing.Optional[network.RequestId]
network_idztyping.Optional[RequestId]redirected_request_idc                    | t         j                  |d         t        j                  j                  |d         t        j
                  j                  |d         t        j                  j                  |d         d|v r"t        j                  j                  |d         nd d|v rt        |d         nd d|v rt        |d         nd d|v r&|d   D cg c]  }t        j                  |       c}nd d	|v r"t        j                   j                  |d	         nd d
|v rt         j                  |d
         
      S d 
      S c c}w )Nrc   r   frameIdr9   responseErrorReasonresponseStatusCoderesponseStatusTextrk   	networkIdredirectedRequestId)
re   r   r   r5   r   r   r   rp   r   r   )r   r   r	   r*   r
   FrameIdr>   ErrorReasonintr!   rA   )r   r   r`   s      r   r   zRequestPaused.from_json  sC    **4+<=OO--d9o>\\++DO<!..88n9MN`uy}`}'"5"5"?"?EZ@["\  DHDX\`D`T*>%?!@fjDX\`D`T*>%?!@fj\mqu\uEV@WX1k33A6X{ITX\I\w((2243DEbfVkosVs)"5"5d;P6Q"R
 	
 z~
 	
 Ys   EN)r   r   r    r   r"   r#   r$   r%   r?   r&   r   r   r   r   r   r     s[     ''??....?? 32 65
 
r   r   zFetch.authRequiredc                  V    e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   edd       Zy)AuthRequiredz
    Issued when the domain is enabled with handleAuthRequests set to true.
    The request is paused until client responds with continueWithAuth.
    r   re   r   r   r   r   r   r5   rG   auth_challengec           
     4    | t         j                  |d         t        j                  j                  |d         t        j
                  j                  |d         t        j                  j                  |d         t        j                  |d               S )Nrc   r   r   r9   authChallenge)re   r   r   r5   r   )r   r   r	   r*   r
   r   r>   rG   r   s     r   r   zAuthRequired.from_json  sz     **4+<=OO--d9o>\\++DO<!..88n9MN(2243HI
 	
r   N)r   r   r    r   r   r   r   r   r   r     s;    
 '' "!
 
r   r   )r    0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])NN)rZ   z,typing.Optional[typing.List[RequestPattern]]r_   typing.Optional[bool]r    r   )re   r   rf   znetwork.ErrorReasonr    r   )NNNN)re   r   ro   r   rp   r   rq   r3   rm   r3   rr   r3   r    r   )NNNNN)re   r   ru   r3   rV   r3   ry   r3   rw   r   rz   r   r    r   )re   r   r~   rO   r    r   )re   r   ro   r   rr   r3   rp   r   rq   r3   r    r   )re   r   r    zCtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[str, bool]])re   r   r    z;typing.Generator[T_JSON_DICT, T_JSON_DICT, io.StreamHandle]) 
__future__r   utilr   r   dataclassesr   enumtyping r   r	   r
   r!   r   Enumr)   r2   rA   rG   rO   rX   ra   rg   rs   r{   r   r   r   r   r   r   r   r   r   <module>r      s   # * !     : :"499 " 
 
 
< 
 
 
,  
  
  
F  
  
  
F BF6:>3 
8.) 
8. GK8<%)04!!! D! "6	!
 #! .! 
8!L %)'+*.=A48""!" %" (	"
 ;" 2" 
8"J!6 
8, /304FJ8<""+" ." D	"
 "6" 
8"J	JD55	B58 "#
2
 2
  $2
j !"

 
  #
r   