
    ^jk	                         d dl Z d dlmZmZmZ d dlmZ d dlmZ erd dl	m
Z
 dZdZded	eeef   d
eeef   fdZ G d de      Zy)    N)TYPE_CHECKINGAnyDict)RemoteConnection)library_version)ParseResultzappium/zX-Idempotency-Keykeyheadersreturnc                     | j                         }|j                         D ci c]  \  }}|j                         |k7  s|| c}}S c c}}w )z`Return a new dictionary of heafers without the given key.
    The key match is case-insensitive.)loweritems)r	   r
   	lower_keykvs        V/home/ubuntu/.local/lib/python3.12/site-packages/appium/webdriver/appium_connection.py_get_new_headersr      s>     		I$]]_GTQ	Y0FAqDGGGs   A	 A	c            
       |     e Zd ZdZe  e        dej                   dZi Ze	d	ddde
deeef   f fd       Z xZS )
AppiumConnectiona^  
    A subclass of selenium.webdriver.remote.remote_connection.Remoteconnection.

    The changes are

    * The default user agent
    * Adds 'X-Idempotency-Key' header in a new session request to avoid proceeding
        the same request multiple times in the Appium server side.
        * https://github.com/appium/appium-base-driver/pull/400
    z ()
parsed_urlr   
keep_aliver   c                    |j                   j                  d      r/t        t        j                               | j
                  t        <   nt        t        | j
                        | _        i t        | %  ||      | j
                  S )zOverride get_remote_connection_headers in RemoteConnection to control the extra headers.
        This method will be used in sending a request method in this class.
        z/session)r   )
pathendswithstruuiduuid4extra_headersHEADER_IDEMOTENCY_KEYr   superget_remote_connection_headers)clsr   r   	__class__s      r   r"   z.AppiumConnection.get_remote_connection_headers5   so     ??##J/7:4::<7HC34 01FHYHY ZCp%'7
z7Zp^a^o^opp    )T)__name__
__module____qualname____doc__PREFIX_HEADERr   r   
user_agentr   classmethodboolr   r   r   r"   __classcell__)r$   s   @r   r   r   &   sl    	 "??#4"5R8H8S8S7TTUVJMq} qRV qbfgjlogobp q qr%   r   )r   typingr   r   r   +selenium.webdriver.remote.remote_connectionr   appium.common.helperr   urllib.parser   r*   r    r   r   r    r%   r   <module>r4      sf     + + H 0( + H# HS#X H4S> Hq' qr%   