
    >ir                       d 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mZmZmZmZmZ ddlmZmZmZmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZ ddlm Z  ddl!m"Z" ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z) ddl*m+Z+m,Z,  ejZ                  e.      Z/ee'e(f   Z0ee%e&f   Z1er$ddl2m3Z3 ddl#m4Z4m5Z5m6Z6 ddl7m8Z8 ee6e)f   Z9ee4e5f   Z: G d d      Z;y)z
This module provides a Request class that mimics the behavior of requests.
It allows making HTTP requests using the browser's fetch API.
    )annotationsN)AsyncIterator)asynccontextmanager)TYPE_CHECKINGAnyCallableOptionalUnioncast)parse_qs	urlencodeurlparse
urlunparse)
HarCaptureHarRecorder)Response)RuntimeCommands)Scripts)	HTTPError)HeaderEntry)NetworkEventRequestWillBeSentEventRequestWillBeSentExtraInfoEventResponseReceivedEventResponseReceivedExtraInfoEvent$ResponseReceivedExtraInfoEventParams)CookieParamResourceType)Tab)RequestWillBeSentEventParams%RequestWillBeSentExtraInfoEventParamsResponseReceivedEventParams)EvaluateResponsec                  d   e Zd ZdZd$dZ	 	 	 	 d%	 	 	 	 	 	 	 	 	 	 	 	 	 d&dZ	 d'	 	 	 	 	 d(dZ	 	 d)	 	 	 	 	 	 	 d*dZ	 	 d)	 	 	 	 	 	 	 d*dZ	 	 d)	 	 	 	 	 	 	 d*dZ	d+d	Z
d+d
Zd+dZe	 d'	 	 	 d,d       Zed-d       Z	 	 	 	 	 	 	 	 	 	 d.dZ	 	 	 	 	 	 	 	 d/dZed0d       Ze	 	 	 	 	 	 d1d       Zd2dZe	 	 	 	 	 	 	 	 	 	 d3d       Zd4dZd4dZd5dZd5dZe	 	 	 	 	 	 d6d       Z	 	 	 	 d7dZ	 	 	 	 d8dZ	 	 	 	 d9dZ	 	 	 	 d:dZed;d       Z d<dZ!d=dZ"d>d Z#ed?d!       Z$ed@d"       Z%edAd#       Z&y)BRequesta	  High-level interface for making HTTP requests using the browser's fetch API.

    This class provides a requests-like interface that executes HTTP requests in the
    browser's JavaScript context. All requests inherit the browser's current session
    state including cookies, authentication headers, and other automatic browser
    behaviors. This allows for seamless interaction with websites that require
    authentication or have complex cookie management.

    Key Features:
    - Executes requests in the browser's JavaScript context using fetch API
    - Automatically includes browser cookies and session state
    - Preserves browser's security context and CORS policies
    - Captures both request and response headers for analysis
    - Supports all standard HTTP methods (GET, POST, PUT, DELETE, etc.)

    Note:
    - Headers passed to methods are additional headers, not replacements
    - Browser's automatic headers (User-Agent, Accept, etc.) are preserved
    - Cookies are managed automatically by the browser
    c                t    || _         d| _        g | _        g | _        g | _        t
        j                  d       y)a:  Initialize a new Request instance bound to a browser tab.

        Args:
            tab: The browser tab instance where requests will be executed.
                This tab provides the JavaScript execution context and maintains
                the browser's session state (cookies, authentication, etc.).
        Fz"Request helper initialized for tabN)tab_network_events_enabled_callback_ids_requests_sent_requests_receivedloggerdebug)selfr'   s     e/var/www/python/tenders/Scrapper/venv/lib/python3.12/site-packages/pydoll/browser/requests/request.py__init__zRequest.__init__S   s8     ',$(*68>@9:    Nc                  K   | j                  ||      } | j                  ||||fi |}	t        j                  d|j	                          d|        t        j                  d|j	                          d| dt        |       d|du d|du 
       	 | j                  ||	       d{   }
| j                         }| j                         }| j                         }| j                  |
|||      | j                          d{    S 7 `7 # t        $ r5}t        j                  d|        t        dt!        |             |d}~ww xY w# | j                          d{  7   w xY ww)a  Execute an HTTP request in the browser's JavaScript context.

        This method uses the browser's fetch API to make requests, inheriting all
        browser session state including cookies, authentication, and security context.
        The request is executed as if made by the browser itself.

        Args:
            method: HTTP method (GET, POST, PUT, DELETE, etc.). Case insensitive.
            url: Target URL for the request. Can be relative or absolute.
            params: Query parameters to append to the URL. These are URL-encoded
                and merged with any existing query string in the URL.
            data: Request body data. Behavior depends on type:
                - dict/list/tuple: URL-encoded as form data (application/x-www-form-urlencoded)
                - str/bytes: Sent as-is with no Content-Type modification
                Mutually exclusive with 'json' parameter.
            json: Data to be JSON-serialized as request body. Automatically sets
                Content-Type to application/json. Mutually exclusive with 'data'.
            headers: Additional headers to include. These are ADDED to browser's
                automatic headers, not replacements.
                Format: [{'name': 'X-Custom', 'value': 'value'}]
            **kwargs: Additional fetch API options (e.g., credentials, mode, cache).

        Returns:
            Response object containing status, headers, content, and cookies from
            both the request and response phases.

        Raises:
            HTTPError: If the request execution fails or network error occurs.

        Note:
            - Browser cookies are automatically included
            - CORS policies are enforced by the browser
            - Authentication headers are preserved from browser session
        zExecuting request: method=z, url=z
, headers=z, json=Nz, data=zRequest failed: )_build_url_with_params_build_request_optionsr,   infoupperr-   bool_execute_fetch_request_extract_received_headers_extract_sent_headers_extract_set_cookies_build_response_clear_callbacks	Exceptionerrorr   str)r.   methodurlparamsdatajsonheaderskwargs	final_urloptionsresultreceived_headerssent_headerscookiesexcs                  r/   requestzRequest.requestb   sw    X //V<	-$--fgtTTVT00@ykRS((8yk JG}oWT-=,>gdRVFVEWY	
	*66y'JJF#==?557L//1G''0@,PWX ''))) K *  	DLL+C512.s3xj9:C	D
 '')))sg   BE-D )D
*AD 1E-DE-
D E-	E0EEE E*#E&$E**E-c                J   K    | j                   d|fd|i| d{   S 7 w)a  Execute a GET request for retrieving data.

        Args:
            url: Target URL to retrieve data from.
            params: Query parameters to append to URL.
            **kwargs: Additional fetch options.

        Returns:
            Response object with retrieved data.
        GETrC   NrO   )r.   rB   rC   rG   s       r/   getzRequest.get   s+       "T\\%FVFvFFFFs   #!#c                L   K    | j                   d|f||d| d{   S 7 w)ad  Execute a POST request for creating or submitting data.

        Args:
            url: Target URL for data submission.
            data: Form data to submit (URL-encoded).
            json: JSON data to submit.
            **kwargs: Additional fetch options.

        Returns:
            Response object with server's response to the submission.
        POSTrD   rE   NrR   r.   rB   rD   rE   rG   s        r/   postzRequest.post   s-     $ "T\\&#NDtNvNNNN   $"$c                L   K    | j                   d|f||d| d{   S 7 w)aY  Execute a PUT request for updating/replacing resources.

        Args:
            url: Target URL of resource to update.
            data: Form data for the update.
            json: JSON data for the update.
            **kwargs: Additional fetch options.

        Returns:
            Response object confirming the update operation.
        PUTrV   NrR   rW   s        r/   putzRequest.put   s-     $ "T\\%M4dMfMMMMrY   c                L   K    | j                   d|f||d| d{   S 7 w)am  Execute a PATCH request for partial resource updates.

        Args:
            url: Target URL of resource to partially update.
            data: Form data with changes to apply.
            json: JSON data with changes to apply.
            **kwargs: Additional fetch options.

        Returns:
            Response object confirming the partial update.
        PATCHrV   NrR   rW   s        r/   patchzRequest.patch   s-     $ "T\\'3OTOOOOOrY   c                F   K    | j                   d|fi | d{   S 7 w)zExecute a DELETE request for removing resources.

        Args:
            url: Target URL of resource to delete.
            **kwargs: Additional fetch options.

        Returns:
            Response object confirming the deletion.
        DELETENrR   r.   rB   rG   s      r/   deletezRequest.delete   s&      "T\\(C:6::::   !!c                F   K    | j                   d|fi | d{   S 7 w)a}  Execute a HEAD request to retrieve only response headers.

        Useful for checking resource existence, size, or modification date
        without downloading the full content.

        Args:
            url: Target URL to check headers for.
            **kwargs: Additional fetch options.

        Returns:
            Response object with headers but no body content.
        HEADNrR   rb   s      r/   headzRequest.head   s&      "T\\&#88888rd   c                F   K    | j                   d|fi | d{   S 7 w)aa  Execute an OPTIONS request to check allowed methods and capabilities.

        Used for CORS preflight checks and discovering server capabilities.

        Args:
            url: Target URL to check options for.
            **kwargs: Additional fetch options.

        Returns:
            Response object with allowed methods and CORS headers.
        OPTIONSNrR   rb   s      r/   rI   zRequest.options  s&      "T\\)S;F;;;;rd   c                  K   t        | j                  |      }t        |      }|j                          d{    	 | |j	                          d{    y7 #7 # |j	                          d{  7   w xY ww)a  Record network traffic as HAR.

        Context manager that captures all network activity on the tab
        and produces a HarCapture object for export.

        Args:
            resource_types: Optional list of resource types to capture.
                When provided, only requests matching these types are
                recorded. When None (default), all resource types are
                captured.

        Usage::

            async with tab.request.record() as capture:
                await tab.go_to('https://example.com')
            capture.save('flow.har')

            # Record only fetch and XHR requests
            async with tab.request.record(
                resource_types=[ResourceType.FETCH, ResourceType.XHR]
            ) as capture:
                await tab.go_to('https://example.com')
            capture.save('api_calls.har')

        Yields:
            HarCapture: Object with .save(), .to_dict(), and .entries.
        )resource_typesN)r   r'   r   startstop)r.   rk   recordercaptures       r/   recordzRequest.record  sf     @ txxGX&nn	"M--/!!	 	 "(--/!!sD   6A>AA>A  A>AA>A> A;4A75A;;A>c                   t         j                  d|  d|        |s| S t        |       }t        |j                        }|j                         D ]  \  }}|g||<    t        |j                  t        |d                  S )z&Build final URL with query parameters.zBuilding URL with params: url=z	, params=Tdoseq)query)	r,   r-   r   r   rt   itemsr   _replacer   )rB   rC   parsedrt   keyvalues         r/   r3   zRequest._build_url_with_paramsB  s     	5cU)F8LMJ#& ,,. 	!JCE#J	! &//	%t0L/MNNr1   c                    |r| j                  |      ni }|j                         |d|}t        j                  d|        | j	                  |||       |S )z!Build request options dictionary.)rA   rF   z"Building request options: options=)_convert_header_entries_to_dictr6   r,   r-   _add_request_body)r.   rA   rF   rE   rD   rG   headers_dictrI   s           r/   r4   zRequest._build_request_optionsP  se     IPt;;GDUWlln#
 

 	9'CDwd3r1   c                X    || j                  ||       y|| j                  ||       yy)z5Add request body and appropriate Content-Type header.N)_handle_json_options_handle_data_options)r.   rI   rE   rD   s       r/   r|   zRequest._add_request_bodyc  s5     %%gt4%%gt4 r1   c                    t        j                  |      | d<   | d   j                  dd       t        j	                  d       y)zHandle JSON options.bodyrF   Content-Typezapplication/jsonz.Request JSON body set and content-type appliedN)jsonlibdumps
setdefaultr,   r-   )rI   rE   s     r/   r   zRequest._handle_json_optionso  s9     "---	%%n6HIEFr1   c                    t        |t        t        t        f      r;t	        |d      | d<   | d   j                  dd       t        j                  d       y	|| d<   t        j                  d       y	)
zHandle data options.Trr   r   rF   r   z!application/x-www-form-urlencodedz'Request data encoded as form-urlencodedzRequest data set as raw payloadN)
isinstancedictlisttupler   r   r,   r-   )rI   rD   s     r/   r   zRequest._handle_data_optionsv  s^    
 dT4/0'D9GFOI)).:]^LLBC"GFOLL:;r1   c                l  K   t         j                  j                  t        j                  |      t        j                  |            }| j                          d{    t        j                  d       | j                  j                  t        j                  |dd             d{   S 7 R7 w)z2Execute the fetch request using browser's runtime.)rB   rI   NzERegistered network callbacks and executing fetch via Runtime.evaluateT)
expressionreturn_by_valueawait_promise)r   MAKE_REQUESTformatr   r   _register_callbacksr,   r-   r'   _execute_commandr   evaluate)r.   rB   rI   scripts       r/   r8   zRequest._execute_fetch_request  s     %%,,s1CW]][bMc,d&&(((\]XX..$$! $"
 
 	
 	)
s%   AB4B0AB4+B2,B42B4c                    | d   d   d   }t         j                  d|        t        |d   t        |j	                  dd            |d   |d   ||||d	   
      S )z(Build Response object from fetch result.rJ   ry   z Building response: result_value=statuscontentr1   textrE   rB   )status_coder   r   rE   response_headersrequest_headersrM   rB   )r,   r-   r   bytesrS   )rJ   r   r   rM   result_values        r/   r<   zRequest._build_response  sw     h'1':7~FG$X.,**9c:;f%f%-+U#	
 		
r1   c                   K    j                   j                  s> j                   j                          d{    d _        t        j                  d       d fd}d fd} j                   j                  t        j                  |       d{    j                   j                  t        j                  |       d{    j                   j                  t        j                  |       d{    j                   j                  t        j                  |       d{   g _        y7 7 7 s7 C7 w)a  Register network event listeners to capture request/response metadata.

        Sets up CDP event listeners to capture all network activity during the
        request execution. This includes both outgoing request data and incoming
        response data, which are used for header and cookie extraction.

        Note:
            Network events are only enabled if not already active on the tab.
        NTz1Network events enabled on tab for request capturec                    j                   j                  t        t        |              t        j                  d|         y )Nz!Appended received request: event=)r+   appendr   RequestReceivedEventr,   r-   eventr.   s    r/   append_received_requestz<Request._register_callbacks.<locals>.append_received_request  s3    ##**40De+LMLL<UGDEr1   c                    j                   j                  t        t        |              t        j                  d|         y )NzAppended sent request: event=)r*   r   r   RequestSentEventr,   r-   r   s    r/   append_sent_requestz8Request._register_callbacks.<locals>.append_sent_request  s3    &&t,<e'DELL8@Ar1   )callback)r   r   returnNone)r'   network_events_enabledenable_network_eventsr(   r,   r-   onr   REQUEST_WILL_BE_SENTREQUEST_WILL_BE_SENT_EXTRA_INFORESPONSE_RECEIVEDRESPONSE_RECEIVED_EXTRA_INFOr)   )r.   r   r   s   `  r/   r   zRequest._register_callbacks  s     xx..((00222+/D(LLLM	F	B
 ((++11,    ((++<<,    ((++..0    ((++990   
 3sX   4D>D4AD>D61D>D81D>6D:71D>(D<
)D>6D>8D>:D><D>c                F  K   | j                   D ]%  }| j                  j                  |       d{    ' | j                   j                          | j                  r?| j                  j                          d{    d| _        t        j                  d       yy7 l7 $w)zClean up network event listeners and disable network monitoring.

        Removes only the callbacks registered by this request instance
        (surgical removal) so other listeners (e.g. HarRecorder) are
        not affected.
        NFz,Network events disabled on tab after request)r)   r'   remove_callbackclearr(   disable_network_eventsr,   r-   )r.   callback_ids     r/   r=   zRequest._clear_callbacks  s       -- 	8K((**;777	8  "''((11333+0D(LLGH ( 8 4s"   .B!BA	B!:B;#B!B!c                l    | j                   | j                  d}| j                  | j                  |      S )zExtract headers from response network events.

        Returns:
            List of headers received from the server during response.
        )responseblockedCookies)"_extract_response_received_headers-_extract_response_received_extra_info_headers_extract_headers_from_eventsr+   r.   event_extractorss     r/   r9   z!Request._extract_received_headers  s;     ??"PPK

 001H1HJZ[[r1   c                l    | j                   | j                  d}| j                  | j                  |      S )zExtract headers from request network events.

        Returns:
            List of headers that were actually sent in the request.
        )rO   associatedCookies)_extract_request_sent_headers(_extract_request_sent_extra_info_headersr   r*   r   s     r/   r:   zRequest._extract_sent_headers  s;     99!%!N!NK

 001D1DFVWWr1   c                   g }t               }t        j                  d|         | D ]  }|d   }|j                         D ]  \  }}||v s ||      }t        j                  d|        |D ]c  }	|	d   |	d   f}
t        j                  d|
        |
|vs*|j	                  |	       |j                  |
       t        j                  d|	        e    t        j                  d|        |S )	a  Extract headers from network events using appropriate extractors.

        Args:
            events: List of network events to process.
            event_extractors: Mapping of event keys to header extraction functions.

        Returns:
            Deduplicated list of headers from all matching events.

        Note:
            Headers are deduplicated based on name-value pairs to avoid
            duplicate entries from multiple event types.
        z'Extracting headers from events: events=rC   z%Extracted headers: extracted_headers=namery   zIdentity: identity=zAdded header: header=zHeaders extracted: headers=)setr,   r-   ru   r   add)eventsr   rF   seenr   rC   rx   	extractorextracted_headersheaderidentitys              r/   r   z$Request._extract_headers_from_events  s   $ &(u>vhGH 	E8_F"2"8"8": Y&=(1&(9%LL#HIZH[!\]"3 K$*6NF7O#D':8*%EF#4/#NN62 HHX."LL+@)IJK 	 	27)<=r1   c                ~    |d   }t         j                  d|        | j                  |j                  di             S )zExtract headers from main request event.

        Args:
            params: Event parameters containing request details.

        Returns:
            List of headers that were sent with the request.
        rO   z)Extracting request sent headers: request=rF   r,   r-   _convert_dict_to_header_entriesrS   )r.   rC   rO   s      r/   r   z%Request._extract_request_sent_headers   s>     #@	JK33GKK	24NOOr1   c                t    t         j                  d|        | j                  |j                  di             S )a}  Extract headers from extra request info event.

        This event contains additional header information that may not be
        present in the main request event, such as security-related headers.

        Args:
            params: Extra info event parameters containing additional headers.

        Returns:
            List of additional headers sent with the request.
        z3Extracting request sent extra info headers: params=rF   r   r.   rC   s     r/   r   z0Request._extract_request_sent_extra_info_headers/  s4     	J6(ST33FJJy"4MNNr1   c                ~    |d   }t         j                  d|        | j                  |j                  di             S )zExtract headers from main response event.

        Args:
            params: Event parameters containing response details.

        Returns:
            List of headers received from the server.
        r   z/Extracting response received headers: response=rF   r   )r.   rC   r   s      r/   r   z*Request._extract_response_received_headers@  s>     *%FxjQR33HLLB4OPPr1   c                t    t         j                  d|        | j                  |j                  di             S )a  Extract headers from extra response info event.

        This event contains additional response header information, including
        Set-Cookie headers and security-related headers that may be filtered
        from the main response event.

        Args:
            params: Extra info event parameters containing additional headers.

        Returns:
            List of additional headers received from the server.
        z8Extracting response received extra info headers: params=rF   r   r   s     r/   r   z5Request._extract_response_received_extra_info_headersO  s5     	OPVxXY33FJJy"4MNNr1   c                    t         j                  d|         | j                         D cg c]  \  }}t        ||       c}}S c c}}w )zConvert header dictionary to standardized HeaderEntry format.

        Args:
            headers_dict: Dictionary mapping header names to values.

        Returns:
            List of HeaderEntry objects with 'name' and 'value' keys.
        z6Converting dictionary to header entries: headers_dict=r   ry   )r,   r-   ru   r   )r}   r   ry   s      r/   r   z'Request._convert_dict_to_header_entriesa  s@     	Ml^\]GSGYGYG[\eU3\\\s   Ac                   g }t         j                  d|        | j                         }t         j                  d|        |D ]  }t        t        |d         }| j                  |d         }t         j                  d|        |D cg c]  }|d   dk(  s|d    }}t         j                  d	|        |sx|D ]#  }| j                  || j                  |             %  t         j                  d
|        |S c c}w )ag  Extract and parse all Set-Cookie headers from response events.

        Processes response events to find Set-Cookie headers and converts them
        into structured cookie objects. Handles multiple Set-Cookie headers
        and multi-line cookie declarations.

        Returns:
            List of unique cookies extracted from Set-Cookie headers.
        z Extracting set cookies: cookies=zAFiltering response extra info events: response_extra_info_events=rC   rF   z1Converting dictionary to header entries: headers=r   z
Set-Cookiery   z'Set cookie headers: set_cookie_headers=zSet cookies extracted: cookies=)r,   r-   "_filter_response_extra_info_eventsr   r   r   _add_unique_cookies_parse_set_cookie_header)	r.   rM   response_extra_info_eventsr   rC   rF   r   set_cookie_headersset_cookie_headers	            r/   r;   zRequest._extract_set_cookiesn  s(    &(7yAB%)%L%L%N"**D)EG	
 0 	E>hPF::6);LMGLLLWIVW.5"$*<9Ww" " LLBCUBVWX!); %,,!>!>?P!Q	 	6wi@A"s   DDc                    t         j                  d| j                          | j                  D cg c]  }|d   t        j                  k(  r| c}S c c}w )zFilter network events to find those containing Set-Cookie information.

        Returns:
            List of events that contain extra response information including cookies.
        z8Filtering response extra info events: requests_received=rA   )r,   r-   r+   r   r   )r.   r   s     r/   r   z*Request._filter_response_extra_info_events  s[     	FtG^G^F_`	

 00
X,"K"KK 
 	
 
s   Ac                   g }|j                  d      }t        j                  d|        |D ]?  }| j                  |      }|st        j                  d|        |j	                  |       A t        j                  d|        |S )a  Parse a Set-Cookie header value into individual cookie objects.

        Handles both single and multi-line Set-Cookie headers, extracting
        cookie name-value pairs while ignoring attributes like Path, Domain, etc.

        Args:
            set_cookie_header: Raw Set-Cookie header value from HTTP response.

        Returns:
            List of parsed cookie objects with name and value.
        
z-Parsing set cookie header: set_cookie_header=zParsed cookie: cookie=zParsed cookies: cookies=)splitr,   r-   _parse_cookie_liner   )r.   r   rM   lineslinecookies         r/   r   z Request._parse_set_cookie_header  s     !''-DEVDWXY 	'D,,T2F5fX>?v&		'
 	/y9:r1   c                    d| vry| j                  dd      d   j                         }| j                  dd      d   j                  dd      d   j                         }|syt        ||      S )a  Parse a single cookie line to extract name and value.

        Extracts only the cookie name and value, ignoring all cookie attributes
        like Path, Domain, Secure, HttpOnly, etc. Rejects cookies with empty names.

        Args:
            line: Single line from Set-Cookie header.

        Returns:
            CookieParam object with name and value, or None if parsing fails or name is empty.
        =N   r   ;r   )r   stripr   )r   r   ry   s      r/   r   zRequest._parse_cookie_line  sq     d?zz#q!!$**,

3"1%++C3A6<<> E22r1   c                    t         j                  d|  d|        |D ]0  }|| vs| j                  |       t         j                  d|        2 t         j                  d|         y)zAdd cookies to list while avoiding duplicates.

        Args:
            cookies: Existing list of cookies to add to.
            new_cookies: New cookies to add if not already present.
        zAdding unique cookies: cookies=z, new_cookies=zAdded unique cookie: cookie=zUnique cookies added: cookies=N)r,   r-   r   )rM   new_cookiesr   s      r/   r   zRequest._add_unique_cookies  sm     	6wi~k][\! 	FFW$v&;F8DE	F 	5gY?@r1   c                j    t         j                  d|         | D ci c]  }|d   |d    c}S c c}w )ap  Convert HeaderEntry objects to a plain dictionary format.

        Used for preparing headers for the JavaScript fetch API which expects
        a simple object mapping header names to values.

        Args:
            headers: List of HeaderEntry objects with 'name' and 'value' keys.

        Returns:
            Dictionary mapping header names to values.
        z1Converting header entries to dictionary: headers=r   ry   )r,   r-   )rF   r   s     r/   r{   z'Request._convert_header_entries_to_dict  s9     	H	RS>EFFvw/FFFs   0)r'   r   )NNNN)rA   r@   rB   r@   rC   Optional[dict[str, str]]rD   .Optional[Union[dict, list, tuple, str, bytes]]rE   Optional[dict[str, Any]]rF   Optional[list[HeaderEntry]]r   r   )N)rB   r@   rC   r   r   r   )NN)rB   r@   rD   r   rE   r   r   r   )rB   r@   r   r   )rk   zlist[ResourceType] | Noner   zAsyncIterator[HarCapture])rB   r@   rC   r   r   r@   )
rA   r@   rF   r   rE   r   rD   r   r   dict[str, Any])rI   r   rE   r   rD   r   r   r   )rI   r   rE   r   r   r   )rI   r   rD   r   r   r   )rB   r@   rI   r   r   r#   )
rJ   r#   r   list[HeaderEntry]r   r   rM   list[CookieParam]r   r   )r   r   )r   r   )r   z9Union[list[RequestSentEvent], list[RequestReceivedEvent]]r   z-dict[str, Callable[[Any], list[HeaderEntry]]]r   r   )rC   r    r   r   )rC   r!   r   r   )rC   r"   r   r   )rC   r   r   r   )r}   r   r   r   )r   r   )r   zlist[RequestReceivedEvent])r   r@   r   r   )r   r@   r   zOptional[CookieParam])rM   r   r   r   r   r   )rF   r   r   zdict[str, str])'__name__
__module____qualname____doc__r0   rO   rS   rX   r\   r_   rc   rg   rI   r   rp   staticmethodr3   r4   r|   r   r   r8   r<   r   r=   r9   r:   r   r   r   r   r   r   r;   r   r   r   r   r{    r1   r/   r%   r%   =   s   *;& ,0?C)-/3?*?* ?* )	?*
 =?* '?* -?* 
?*H ,0GG )G
 
G* @D)-	OO =O '	O 
O. @D)-	NN =N '	N 
N. @D)-	PP =P '	P 
P(
;9<  59%"1%" 
#%" %"N O O - '	
 = 
&
5
5 '
5 =	
5
 

5 G G 
<
<'U
<	
< 
<
 
 
+
 +
 #	

 

 
((
TI\X $I$G$ 
$ $LP2P	PO;O	O"Q1Q	QO:O	O$ 
] 
]B
. 3 30 A A G Gr1   r%   )<r   
__future__r   rE   r   loggingcollections.abcr   
contextlibr   typingr   r   r   r	   r
   r   urllib.parser   r   r   r   $pydoll.browser.requests.har_recorderr   r    pydoll.browser.requests.responser    pydoll.commands.runtime_commandsr   pydoll.constantsr   pydoll.exceptionsr   pydoll.protocol.fetch.typesr   pydoll.protocol.network.eventsr   r   r   r   r   r   pydoll.protocol.network.typesr   r   	getLoggerr   r,   r   r   pydoll.browser.tabr   r    r!   r"   pydoll.protocol.runtime.methodsr#   RequestReceivedEventParamsRequestSentEventParamsr%   r   r1   r/   <module>r     s   
 #   ) * F F B B H 5 < $ ' 3  D			8	$"$  #% 
 & 
 A!&#,	." #$-	/n
G n
Gr1   