
    BThd                     R    d Z ddl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 Zy)	zStubs for tornado HTTP clients    N)BytesIO)httputil)HTTPResponse)(CannotOverwriteExistingCassetteException)Requestc                 F     t        j                         fd       }|S )Nc           
         |j                   j                         }|j                  r|j                  d|j                         t	        |dd       d uxs |j
                  d uxs |j                  d u}|rIt        |dt        d|d      | j                  j                         |j                  z
        } |      S t        |j                  |j                  |j                  |      j!                        r։j#                        }t%        j&                         }|d   }t)        |t*              r|j-                         }|D ]  \  }}	|	D ]  }
|j/                  ||
          t        ||d   d	   |d   d
   |t1        |d   d         |j3                  d      | j                  j                         |j                  z
        } |      S j4                  rXj7                        rGt        |dt9              | j                  j                         |j                  z
        } |      S fd} | ||       y )Nz
User-Agentbody_produceriW  zThe request (z{) uses AsyncHTTPClient functionality that is not yet supported by VCR.py. Please make the request outside a VCR.py context.)errorrequest_timeheadersstatuscodemessagebodystringurl)r   reasonr   buffereffective_urlr   )cassettefailed_requestc                 .   | j                   j                         D cg c]  }|| j                   j                  |      f! }}| j                  | j                  d|d| j
                  i| j                  d}j                  |        |       S c c}w )N)r   r   r   )r   r   r   r   )r   keysget_listr   r   r   r   append)responsekr   vcr_responsecallbackr   vcr_requests       i/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/vcr/stubs/tornado_stubs.pynew_callbackz<vcr_fetch_impl.<locals>.new_fetch_impl.<locals>.new_callbackL   s    FNFVFVF[F[F]^Ax//88;<^^ (0}}Q&%x}}5#11	  \:)) _s   $B)r   copy
user_agent
setdefaultgetattrheader_callbackstreaming_callbackr   	Exceptionio_looptime
start_timer   methodr   r   can_play_response_forplay_responser   HTTPHeaders
isinstancedictitemsaddr   getwrite_protectedfilter_requestr   )selfrequestr    r   unsupported_callr   r   recorded_headersr   vsvr#   r!   r   real_fetch_impls     `         @r"   new_fetch_implz&vcr_fetch_impl.<locals>.new_fetch_impl   sL   //&&(|W-?-?@ G_d34? 6&&d26))5 	
 ##G; /8 8
 "\\..073E3EE	H H%%gnngkk7<<Q))+6#11+>L**,G+I6*D1#3#9#9#; ) &2 &AKK1%&& $!(+F3#H-i8|F3H=>*..u5!\\..073E3EEH H%%''H,C,CK,P'B!)'2 "&!2!2!4w7I7I!I  ))
* D'<8    )	functoolswraps)r   r?   r@   s   `` r"   vcr_fetch_implrD      s)    ___%I9 &I9V rA   )__doc__rB   ior   tornador   tornado.httpclientr   
vcr.errorsr   vcr.requestr   rD    rA   r"   <module>rL      s     $    + ? MrA   