
    lhs                         d dl Z d dlmZ d dlmZ d dlmZ er$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 d Zd Zd Zd Zd Zy)    N)should_send_default_pii)_filter_headers)TYPE_CHECKING)Any)Dict)Optional)Union)Literal)AnnotatedValuec                     i }| d   D ]?  \  }}|j                  d      }|j                  d      }||v r||   dz   |z   ||<   ;|||<   A |S )z^
    Extract headers from the ASGI scope, in the format that the Sentry protocol expects.
    headerslatin-1z, )decode)
asgi_scoper   raw_key	raw_valuekeyvalues         v/var/www/pru.catia.catastroantioquia-mas.com/tasa/lib/python3.12/site-packages/sentry_sdk/integrations/_asgi_common.py_get_headersr      sn    
 G(3 !nnY'  +'>"3<$.6GCL GCL! N    c                    | j                  d|      }| j                  dd      }| j                  dd      | j                  dd      z   }|r	|d||S |5|\  }}dd	dd	d
j                  |      }||k7  r|d|d||S |d||S |S )zR
    Extract URL from the ASGI scope, without also including the querystring.
    schemeserverN	root_path pathz://P   i  )httphttpswswss:)get)r   default_schemehostr   r   r   portdefault_ports           r   _get_urlr)   #   s    
 ^^Hn5F^^Hd+F>>+r*Z^^FB-GGD$dD11
d "S3GKKFS<%+T4>>$dD11Kr   c                     | j                  d      }|syt        j                  j                  |j	                  d            S )zb
    Extract querystring from the ASGI scope, in the format that the Sentry protocol expects.
    query_stringNr   )r$   urllibparseunquoter   )r   qss     r   
_get_queryr0   9   s6    
 
	'B<<		) 455r   c                     t        |       }	 |d   j                  d      d   j                         S # t        t        f$ r Y nw xY w	 |d   S # t        $ r Y nw xY w| j                  d      d   S )zh
    Extract IP Address from the ASGI scope based on request headers with fallback to scope client.
    zx-forwarded-for,r   z	x-real-ipclient)r   splitstripKeyError
IndexErrorr$   )r   r   s     r   _get_ipr8   D   s    
 :&G()//4Q7==??j! {##  >>(#A&&s!   $2 AAA 	AAc                 8   i }| d   }|dv ra| j                  d      |d<   t        t        |             x|d<   }t        |       |d<   t	        | |dk(  rdnd|j                  d            |d	<   | j                  d
      }|rt               rdt        |       i|d<   |S )zG
    Returns data related to the HTTP request from the ASGI scope.
    type)r   	websocketmethodr   r+   r   r!   r&   urlr3   REMOTE_ADDRenv)r$   r   r   r0   r)   r   r8   )r   request_datatyr   r3   s        r   _get_request_datarB   W   s    
 L	F	B	""!+!9X,;L<T,UUY''1*'=^$&",D'++f:M
U ^^H%F)+,gj.ABUr   )r,   sentry_sdk.scoper   $sentry_sdk.integrations._wsgi_commonr   typingr   r   r   r   r	   typing_extensionsr
   sentry_sdk.utilsr   r   r)   r0   r8   rB    r   r   <module>rI      s?     4 @  )/",6'&r   