Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/sentry_sdk/__pycache__/transport.cpython-311.pyc



]j-ddlmZddlZddlZddlZddlZddlmZmZddlm	Z	m
Z
mZmZddl
mZddlmZddlmZerLddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZm Z ee!Z"	ddl#m$Z$n#e%$r	ddl&m$Z$YnwxYwGdde'Z(ddZ)Gdde(Z*Gdde(Z+dZ,dS))print_functionN)datetime	timedelta)Dsnloggercapture_internal_exceptions
json_dumps)BackgroundWorker)Envelope)MYPY)Any)Callable)Dict)Iterable)Optional)Tuple)Type)Union)PoolManager)ProxyManager)EventEndpointType)
getproxiescBeZdZdZdZ	d	dZdZdZ	d	dZdZ	dZ
dS)
	TransportzWBaseclass for all transports.

    A transport is used to send an event to sentry.
    Nc~||_|r,|d$|drt|d|_dSd|_dS)Ndsn)optionsr
parsed_dsn)selfrs  K/opt/imunify360/venv/lib64/python3.11/site-packages/sentry_sdk/transport.py__init__zTransport.__init__/sG	#wu~1gen1!'%.11DOOO"DOOOct)zm
        This gets invoked with the event dictionary when an event should
        be sent to sentry.
        NotImplementedErrorr events  r!
capture_eventzTransport.capture_event9s"###r#ct)a$
        Send an envelope to Sentry.

        Envelopes are a data container format that can hold any type of data
        submitted to Sentry. We use it for transactions and sessions, but
        regular "error" events should go through `capture_event` for backwards
        compat.
        r%)r envelopes  r!capture_envelopezTransport.capture_envelopeCs"###r#cdS)z=Wait `timeout` seconds for the current events to be sent out.Nr timeoutcallbacks   r!flushzTransport.flushQs		
r#cdS)zForcefully kills the transport.Nr.r s r!killzTransport.killZs		
r#cR	|dS#t$rYdSwxYwN)r5	Exceptionr4s r!__del__zTransport.__del___s:	IIKKKKK			DD	s
&&r7)__name__
__module____qualname____doc__rr"r)r,r2r5r9r.r#r!rr's
J####$$$$$$"






r#rc#pK|tj}|dD]}	|dd\}}}|t	t|z}|r|dpdD]}||fV	r#ttf$rYwxYwdS)N,:seconds;r7)rutcnowsplitstriprintLookupError
ValueError)headernowlimitretry_after
categories_categorys       r!_parse_rate_limitsrRgs
{oc""	).)<)<S!)D)D&KQ	#k2B2B C C CCK&@:+;+;C+@+@KG
,
,+++++
,Z(			H	
sA.BB32B3cheZdZdZdZdZ	ddZdZdZdZ	d	Z
d
ZdZdZ
d
Z	ddZdZdS)
HttpTransportzThe default HTTP transport.cddlm}t|||jJt|_|jd|z|_i|_	tj|_
||_||j|d|d|d|_ddlm}||_dS)	Nr)VERSIONzsentry.python/%s
http_proxyhttps_proxyca_certs)rWrXrY)Hub)sentry_sdk.constsrVrr"rr
_workerto_auth_auth_disabled_untilurllib3utilRetry_retryr
_make_pool_pool
sentry_sdkrZhub_cls)r rrVrZs    r!r"zHttpTransport.__init__ys	.-----4)))***'))_,,-?'-IJJ
!l((**__O|,
.Z(	%


	#"""""r#c6|jd}|r)|jt	|dS|jdkrHt
jt|j	
|pdz|jd<dSdS)Nzx-sentry-rate-limits<rB)headersgetr_updaterRstatusrrErrcget_retry_after)r responserKs   r!_update_rate_limitsz!HttpTransport._update_rate_limitss
!%%&<==		 ''(:6(B(BCCCCC
_
#
#)1):):Y33H==C>>>*D &&&$
#r#storec<|t|jjt|jd|jdt|j|||}	|||j	dkrn6|j	dks|j	dkr tjd|j	|j|
dS#|
wxYw)N)z
User-Agentz
X-Sentry-AuthPOST)bodyrkrii,z%Unexpected status code: %s (body: %s))rmstrr^client	to_headerrerequestget_api_urlrqrnrerrordataclose)r rurk
endpoint_typerps     r!
_send_requestzHttpTransport._send_requests"	!$*"344!$TZ%9%9%;%;!<!<

	
	
	
:%%
&&}5566	&

	$$X...#%%C''8?S+@+@;OM
NNHNNs
ADDc:fd}||p
|dS)Ncnj|}|duo|tjkSr7)r_rlrrE)buckettsr s  r!	_disabledz0HttpTransport._check_disabled.<locals>._disableds5%))&11BT><b8?+<+<&<<r#r.)r rQrs`  r!_check_disabledzHttpTransport._check_disableds;	=	=	=	=	=
y""5iioo5r#cP|drdStj}tj|d5}|t
|dddn#1swxYwY|jJtj	d|
dpdd|
dpdd	|
d
pdd|jjd|jj
|
|d
dddS)Nr|wfileobjmodezSending event, type:typenullz level:levelz
 event_id:event_idz	 project:z host:zapplication/jsongzipzContent-TypezContent-Encoding)rk)rioBytesIOrGzipFilewriter	rrdebugrl
project_idhostrgetvalue)r r(rufs    r!_send_eventzHttpTransport._send_events{
((	4z||
]4c
2
2
2	'a
GGJu%%&&&	'	'	'	'	'	'	'	'	'	'	'	'	'	'	'***		&!!+V++		'"",f,,		*%%///***$$

		
		
		
	
MMOO%7VTT		
	
	
ts#A00A47A4cfd|jD|jdd<|jsdStj}tj|d5}||dddn#1swxYwYjJtjd|j	jj
jj|
dddd	dS)
NcHg|]}|j|Sr.)r
data_category).0xr s  r!
<listcomp>z0HttpTransport._send_envelope.<locals>.<listcomp>s>


T-A-A!/-R-R




r#rrz(Sending envelope [%s] project:%s host:%szapplication/x-sentry-enveloperrr+)rkr)itemsrrrrserialize_intorrrdescriptionrrrr)r r+rurs`   r!_send_envelopezHttpTransport._send_envelopesR



~


qqq~	4z||
]4c
2
2
2	'a##A&&&	'	'	'	'	'	'	'	'	'	'	'	'	'	'	'***6 O&O 		
	
	
	
MMOO ?$*%
		
	
	
tsA33A7:A7c4dd|ptjdS)NrA
CERT_REQUIRED)	num_pools	cert_reqsrY)certifiwhere)r rYs  r!_get_pool_optionszHttpTransport._get_pool_optionss'( 3GMOO

	
r#ctd}|sdS|dD]M}|}|j|s|j|rdSNdS)NnoFr?T)rrlrFrGrendswithnetloc)r rno_proxyrs    r!_in_no_proxyzHttpTransport._in_no_proxys<<##D))	5NN3''		D::<<D''--
1B1K1KD1Q1Q
tt
ur#cnd}||}|jdkr,|dkr&|p#|o td}|s,|dkr&|p#|o td}||}|rtj|fi|Stjdi|S)Nhttpshttpr.)rschemerrlrr`rr)r rrWrXrYproxyroptss        r!rdzHttpTransport._make_pool"s$$Z00''[B->->OL$NZ\\5E5Eg5N5NE	N***Mx<#LJLL4D4DV4L4LE%%h//	/'66666&.....r#cfjjfd}j|dS)Nc5t5dddn#1swxYwYddddS#1swxYwYdSr7)rr)r(hubr sr!send_event_wrapperz7HttpTransport.capture_event.<locals>.send_event_wrapperBs
,
,022,,$$U+++,,,,,,,,,,,,,,,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,,A
5A
9	A
9	A

AArgcurrentr\submit)r r(rrs`` @r!r)zHttpTransport.capture_event<sSl"	,	,	,	,	,	,	,	
./////r#cfjjfd}j|dS)Nc5t5dddn#1swxYwYddddS#1swxYwYdSr7)rr)r+rr sr!send_envelope_wrapperz=HttpTransport.capture_envelope.<locals>.send_envelope_wrapperPs
2
202222''111222222222222222
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2rr)r r+rrs`` @r!r,zHttpTransport.capture_envelopeJsSl"	2	2	2	2	2	2	2	
122222r#Ncttjd|dkr|j||dSdS)NzFlushing HTTP transportr)rrr\r2r/s   r!r2zHttpTransport.flushXsC	.///Q;;Lw11111;r#c`tjd|jdS)NzKilling HTTP transport)rrr\r5r4s r!r5zHttpTransport.killbs--...r#)rrr7)r:r;r<r=r"rqrrrrrrrdr)r,r2r5r.r#r!rTrTvs%%2*	####J666:B


			///4000333"2222r#rTceZdZdZdZdS)_FunctionTransportcHt|||_dSr7)rr"_func)r funcs  r!r"z_FunctionTransport.__init__is#	4   


r#c0||dSr7)rr's  r!r)z _FunctionTransport.capture_eventps	

5tr#N)r:r;r<r"r)r.r#r!rrhs2r#rc|d}|t}nbt|tr|St|trt	|tr|}nt|rt
|S|dr||SdS)N	transportr)rT
isinstancerr
issubclasscallabler)r
ref_transport
transport_clss   r!make_transportrxsK(M%

	M9	-	-1	M4	(	(1Z
y-Q-Q1%

	-	 	 1!-000u~&}W%%%4r#r7)-
__future__rrr`rrrrsentry_sdk.utilsrrrr	sentry_sdk.workerr
sentry_sdk.envelopersentry_sdk._typesrtypingr
rrrrrrrurllib3.poolmanagerrrrrrwDataCategoryurllib.requestrImportErrorurllibobjectrrRrTrrr.r#r!<module>rs%%%%%%				((((((((QQQQQQQQQQQQ......((((((""""""!//////00000055555555C=L")))))))"""!!!!!!!!"========@oooooIoood







 sBB! B!
Back to Directory File Manager