
    'h                         d dl Z d dlZd dlZd dlmZmZmZmZmZ  G d dej                        Z
 G d dej                        Zy)    N)connections
controller
exceptionsstateobjectversionc                   V    e Zd ZdZdZddeddfdZ eee      Z	d Z
d	 Zed
        Zy)Errora  
        An Error.

        This is distinct from an protocol error response (say, a HTTP code 500),
        which is represented by a normal HTTPResponse object. This class is
        responsible for indicating errors that fall outside of normal protocol
        communications, like interrupted connections, timeouts, protocol errors.

        Exposes the following attributes:

            msg: Message describing the error
            timestamp: Seconds since the epoch
    zConnection killed.Nmsgreturnc                 L    || _         |xs t        j                         | _        y)z?
        @type msg: str
        @type timestamp: float
        N)r
   time	timestamp)selfr
   r   s      f/var/www/html/scrapers/gsc/venv/lib/python3.12/site-packages/seleniumwire/thirdparty/mitmproxy/flow.py__init__zError.__init__   s    
 "1diik    )r
   r   c                     | j                   S Nr
   r   s    r   __str__zError.__str__&       xxr   c                     | j                   S r   r   r   s    r   __repr__zError.__repr__)   r   r   c                 8     | d       }|j                  |       |S r   	set_stateclsstatefs      r   
from_statezError.from_state,   s     I	Er   r   )__name__
__module____qualname____doc__KILLED_MESSAGEstrr   dictfloat_stateobject_attributesr   r   classmethodr"    r   r   r	   r	      sR     *N2C 2D 2 #
  r   r	   c                   V    e Zd ZdZ	 ddedej                  dej                  deddf
dZ	 e
eeej                  ej                  eeeeej                  eej                  f   		      Z fd
Z fdZed        Z fdZd ZddZd Zed        Zd Zd Zd Zedefd       Z xZS )Flowz
    A Flow is a collection of objects representing a single transaction.
    This class is usually subclassed for each protocol, e.g. HTTPFlow.
    Ntypeclient_connserver_connliver   c                     || _         t        t        j                               | _        || _        || _        || _        d | _        d| _	        d | _
        d | _        d| _        d | _        t               | _        y NF)r0   r(   uuiduuid4idr1   r2   r3   errorintercepted_backupreplymarked	is_replayr)   metadata)r   r0   r1   r2   r3   s        r   r   zFlow.__init__<   sh     	djjl#&&	-1
!&.28<
!/36:fr   )	r8   r9   r1   r2   r0   r:   r>   r=   r?   c                     t         |          }|j                  t        j                         | j
                  r+| j
                  |k7  r|j                  | j
                         |S )N)r   )backup)super	get_stateupdater   FLOW_FORMAT_VERSIONr;   )r   d	__class__s     r   rC   zFlow.get_state]   sM    G	445<<DLLA-HHDLLH)r   c                     |j                         }|j                  d       d|v r|j                  d      | _        t        |   |       y )Nr   rA   )copypopr;   rB   r   )r   r    rG   s     r   r   zFlow.set_stated   s?    

		)u 99X.DL% r   c                 :     | d d       }|j                  |       |S r   r   r   s      r   r"   zFlow.from_statek   s    dO	Er   c                 |    t         |          }d|_        | j                  t	        j
                         |_        |S r5   )rB   rI   r3   r<   r   
DummyReply)r   r!   rG   s     r   rI   z	Flow.copyq   s4    GLN::! ++-AGr   c                 V    | j                   r| j                   | j                         k7  S y)z2
            Has this Flow been modified?
        Fr;   rC   r   s    r   modifiedzFlow.modifiedx   s$     <<<<4>>#333r   c                 H    | j                   s| j                         | _         yy)zq
            Save a backup of this Flow, which can be reverted to using a
            call to .revert().
        NrO   )r   forces     r   rA   zFlow.backup   s    
 ||>>+DL r   c                 b    | j                   r#| j                  | j                          d| _         yy)z9
            Revert to the last backed up state.
        N)r;   r   r   s    r   revertzFlow.revert   s'     <<NN4<<(DL r   c                     | j                   xrA | j                   j                  dv xr' | j                   j                  t        j                  k7  S )N>   starttaken)r<   r    valuer   Killr   s    r   killablezFlow.killable   sC     JJ 0JJ 220JJ
/	
r   c                     t        t         j                        | _        d| _        | j                  j                  d       d| _        y)z(
            Kill this request.
        FT)rR   N)r	   r'   r9   r:   r<   killr3   r   s    r   r\   z	Flow.kill   s7     5//0
 

d#	r   c                 `    | j                   ryd| _         | j                  j                          y)zc
            Intercept this Flow. Processing will stop until resume is
            called.
        NT)r:   r<   taker   s    r   	interceptzFlow.intercept   s&    
 

r   c                     | j                   syd| _         | j                  j                  dk(  r5| j                  j                          | j                  j	                          yy)zK
            Continue with the flow - called after an intercept().
        NFrW   )r:   r<   r    ackcommitr   s    r   resumezFlow.resume   sM      ::w&JJNNJJ 'r   c                 .    | j                   j                  S )zStart time of the flow.)r1   timestamp_startr   s    r   re   zFlow.timestamp_start   s     ///r   r   )F) r#   r$   r%   r&   r(   r   ClientConnectionServerConnectionboolr   r)   r	   typingDictAnyr+   rC   r   r,   r"   rI   rP   rA   rT   propertyrZ   r\   r_   rc   r*   re   __classcell__)rG   s   @r   r/   r/   5   s    == %55= %55	=
 = 
=* #0000S&**_-
!  
,  
 

  0 0 0r   r/   )r   ri   r6   !seleniumwire.thirdparty.mitmproxyr   r   r   r   r   StateObjectr	   r/   r-   r   r   <module>rp      s;       g g*K## *ZF0;"" F0r   