a
    xd)                     @   s   d dl mZ d dlmZmZ d dlmZ d dlmZ erDd dl	m
Z
 zd dlmZmZmZmZ W n eyz   edY n0 dgZG d	d deZd
d Zdd ZdS )    )Hub)IntegrationDidNotEnable)logger)MYPY)Any)AsyncClientClientRequestResponsezhttpx is not installedHttpxIntegrationc                   @   s   e Zd ZdZedd ZdS )r   httpxc                   C   s   t   t  dS )z
        httpx has its own transport layer and can be customized when needed,
        so patch Client.send and AsyncClient.send to support both synchronous and async interfaces.
        N)_install_httpx_client_install_httpx_async_client r   r   U/var/www/html/Ranjet/env/lib/python3.9/site-packages/sentry_sdk/integrations/httpx.py
setup_once   s    zHttpxIntegration.setup_onceN)__name__
__module____qualname__
identifierstaticmethodr   r   r   r   r   r      s   c                     s   t j  fdd} | t _d S )Nc              	      s   t j}|td u r& | |fi |S |jdd|j|jf d}|d|j |dt|j |	 D ]*\}}t
dj|||jd ||j|< qj | |fi |}|d|j ||j |d	|j |W  d    S 1 s0    Y  d S 
Nhttpz%s %s)opdescriptionmethodurlzE[Tracing] Adding `{key}` header {value} to outgoing request to {url}.)keyvaluer   status_codereasonr   currentZget_integrationr   Z
start_spanr   r   set_datastrZiter_trace_propagation_headersr   debugformatheadersr    Zset_http_statusZreason_phraseselfrequestkwargsZhubspanr   r   rvZ	real_sendr   r   send%   s*    z#_install_httpx_client.<locals>.send)r	   r0   r0   r   r/   r   r   !   s    r   c                     s   t j  fdd} | t _d S )Nc              	      s  t j}|td u r, | |fi |I d H S |jdd|j|jf d}|d|j |dt|j |	 D ]*\}}t
dj|||jd ||j|< qp | |fi |I d H }|d|j ||j |d	|j |W  d    S 1  s0    Y  d S r   r"   r)   r/   r   r   r0   E   s*    z)_install_httpx_async_client.<locals>.send)r   r0   r1   r   r/   r   r   A   s    r   N)Z
sentry_sdkr   Zsentry_sdk.integrationsr   r   Zsentry_sdk.utilsr   Zsentry_sdk._typesr   typingr   r   r   r	   r
   r   ImportError__all__r   r   r   r   r   r   r   <module>   s    