
    hg                         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dS )    N)connections
controller
exceptionsstateobjectversionc                   d    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dS )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                 H    || _         |pt          j                    | _        dS )z?
        @type msg: str
        @type timestamp: float
        N)r
   time	timestamp)selfr
   r   s      _/var/www/fb-scrape/myenv/lib/python3.11/site-packages/seleniumwire/thirdparty/mitmproxy/flow.py__init__zError.__init__   s!    
 "1dikk    )r
   r   c                     | j         S Nr
   r   s    r   __str__zError.__str__&   	    xr   c                     | j         S r   r   r   s    r   __repr__zError.__repr__)   r   r   c                 F     | d           }|                     |           |S r   	set_stateclsstatefs      r   
from_statezError.from_state,   s(     CII	Er   r   )__name__
__module____qualname____doc__KILLED_MESSAGEstrr   dictfloat_stateobject_attributesr   r   classmethodr"    r   r   r	   r	      s          *N2 2C 2D 2 2 2 2 #d  
       [  r   r	   c                   8    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                      | _        d S 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__<   sq     	djll##&&	-1
!&.28<
!/36:ffr   )	r8   r9   r1   r2   r0   r:   r>   r=   r?   c                     t                                                      }|                    t          j                   | j        r&| j        |k    r|                    | j                   |S )N)r   )backup)super	get_stateupdater   FLOW_FORMAT_VERSIONr;   )r   d	__class__s     r   rC   zFlow.get_state]   s`    GG	4555< 	*DLA--HHDLH)))r   c                     |                                 }|                    d           d|v r|                    d          | _        t                                          |           d S )Nr   rA   )copypopr;   rB   r   )r   r    rG   s     r   r   zFlow.set_stated   s^    

		)u 99X..DL%     r   c                 H     | d d           }|                     |           |S r   r   r   s      r   r"   zFlow.from_statek   s(    CdOO	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   s8    GGLLNN:! +--AGr   c                 N    | j         r| j         |                                 k    S dS )z2
            Has this Flow been modified?
        Fr;   rC   r   s    r   modifiedzFlow.modifiedx   s*     < 	<4>>#3#3335r   Fc                 J    | j         s|                                 | _         dS dS )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-    
 | 	,>>++DLLL	, 	,r   c                 Z    | j         r#|                     | j                    d| _         dS dS )z9
            Revert to the last backed up state.
        N)r;   r   r   s    r   revertzFlow.revert   s7     < 	 NN4<(((DLLL	  	 r   c                 `    | j         o'| j         j        dv o| j         j        t          j        k    S )N>   starttaken)r<   r    valuer   Killr   s    r   killablezFlow.killable   s5     J 0J 220J
/	
r   c                     t          t           j                  | _        d| _        | j                            d           d| _        dS )z(
            Kill this request.
        FT)rR   N)r	   r'   r9   r:   r<   killr3   r   s    r   r\   z	Flow.kill   s?     5/00
 
d###			r   c                 X    | j         rdS d| _         | j                                         dS )zc
            Intercept this Flow. Processing will stop until resume is
            called.
        NT)r:   r<   taker   s    r   	interceptzFlow.intercept   s4    
  	F
r   c                     | j         sdS d| _         | j        j        dk    r4| j                                         | j                                         dS dS )zK
            Continue with the flow - called after an intercept().
        NFrW   )r:   r<   r    ackcommitr   s    r   resumezFlow.resume   s`      	F :w&&JNNJ '&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	=
 = 
= = = =* #d00S&*_-
 
 
    ! ! ! ! !   [
      , , , ,      
 
 X
    
  
  
  0 0 0 0 X0 0 0 0 0r   r/   )r   ri   r6   !seleniumwire.thirdparty.mitmproxyr   r   r   r   r   StateObjectr	   r/   r-   r   r   <module>rp      s       g g g g g g g g g g g g g g* * * * *K# * * *ZF0 F0 F0 F0 F0;" F0 F0 F0 F0 F0r   