bgjYddlmZddlZddlZddlZddlmZddlZddlmZm Z m Z ddl m Z m Z mZmZmZmZmZmZmZddlmZddlmZmZddlmZdd lmZmZmZm Z m!Z!dd l"m#Z#dd l m$Z$dd l%m&Z&dd l'm(Z(ddl)m*Z*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1e1r2ddl2m3Z3ddl2m4Z4ddl2m5Z5ddl2m6Z6ddl2m7Z7ddl8m9Z9ddl0m:Z:m;Z;ddlde de dgdZ?dZ@ eAZBn #eC$reDZBYnwxYwGd d!eEZFddl0m1Z1e1r(Gd"d#e!e5eGe3fZHGd$d%e!eFZIdSd&ZHd'ZIdS)() import_moduleN)datetime) string_types text_type iteritems) capture_internal_exceptionscurrent_stacktracedisable_capture_eventformat_timestamp get_sdk_name get_type_nameget_default_release handle_in_applogger) serialize)tracehas_tracing_enabled)make_transport)DEFAULT_MAX_VALUE_LENGTHDEFAULT_OPTIONS INSTRUMENTERVERSIONClientConstructor)setup_integrations) ContextVar)SessionFlusher)Envelope)has_profiling_enabledsetup_profiler) EventScrubber)Monitor) TYPE_CHECKING)Any)Callable)Dict)Optional)Sequence)Scope)EventHint)Sessionclient_init_debugz sentry.pythonzpypi:sentry-sdk)nameversion)r-r.packagescr|rCt|dtttfs|d|d}|dd}nd}t |dkrt dt t}t |i|}||d||d<t|D]d\}}||vrV|dkrd}tj |||d<+|dkrd }tj |||d <Mt d ||||<e|d"tj d |d<|d t|d <|d$tj dpd|d<|d+tt drt!j|d<|dt$j|d<|d, tj}n#t*$rd}YnwxYw||d<|ddur |dd|d<|dt-|d<|S)Nrz+Only single positional argument is expecteddsn with_localszDeprecated: The option 'with_locals' was renamed to 'include_local_variables'. Please use 'include_local_variables'. The option 'with_locals' will be removed in the future.include_local_variablesrequest_bodieszDeprecated: The option 'request_bodies' was renamed to 'max_request_body_size'. Please use 'max_request_body_size'. The option 'request_bodies' will be removed in the future.max_request_body_sizezUnknown option SENTRY_DSNrelease environmentSENTRY_ENVIRONMENT production server_name gethostname instrumenter project_rootenable_tracingTtraces_sample_rate?event_scrubber) isinstancerbytesstrlen TypeErrordictrgetrrwarningosenvironrhasattrsocketr=rSENTRYgetcwd Exceptionr ) argskwargsr2rvoptionskeyvaluemsgr?s H/opt/cloudlinux/venv/lib64/python3.11/site-packages/sentry_sdk/client.py _get_optionsr[>s DGi%<==a1gABBx 4yy1}}EFFF o  BD#F##G 7;;u--5(( U b==m##ts###05,-&&&us###.3*+)33899 93 %yJNN<005  )}+--9  - JNN+?@@PL= - WV]%C%C ".00= .!)0> .! 9;;LL   LLL *> t##+?(@(H#&   #,  IsG00 G?>G?ceZdZdZdZdZdZdZdZe dZ dZ d Z dd Z d Zd Z ddZdZ ddZ ddZdZdZd S)_ClientzThe client is internally responsible for capturing the events and forwarding them to sentry through the configured transport. It takes the client options as keyword arguments and optionally the DSN as first argument. cPt|i||_|dSN) get_optionsrV _init_impl)selfrSrTs rZ__init__z_Client.__init__s,"D3F33  cd|jiSNrVrVrbs rZ __getstate__z_Client.__getstate__s4<((rdcH|d|_|dSrf)rVra)rbstates rZ __setstate__z_Client.__setstate__s$Y'  rdc |D]m}d}|d}|dd\}} t|}t||}t||t |t jd|z#t$r |dd\}}t|}t||} t| |}t| |t |t||| t jd|n-#t$r } t j d|| Yd} ~ nd} ~ wwxYwYBt$r!} t j d|| Yd} ~ gd} ~ wwxYwdS)z Instruments the functions given in the list `functions_to_trace` with the `@sentry_sdk.tracing.trace` decorator. Nqualified_name.r1zEnabled tracing for %szWCan not enable tracing for '%s'. (%s) Please check your `functions_to_trace` parameter.) rsplitrgetattrsetattrrrdebugmodule_not_found_errorrRrK) rbfunctions_to_tracefunction class_namefunction_qualname module_name function_name module_obj function_obj class_objes rZ_setup_instrumentationz_Client._setup_instrumentations +' ' HJ ()9 : ):)A)A#q)I)I &K" +;77 &z=AA  M53F3FGGG 57HIIII)   /:.@.@a.H.H+K!.{!;!;J ' J ? ?I#*9m#D#DLI}eL6I6IJJJJ I>>>L!9;LMMMM Nq)   m% E' ' sIAA== E/B DE/ D?D:5E/:D??E/ E/E**E/ctd}fd} tjdt j_d_jr:jdddrtj_t|_ d}jd|vr"td |tjd jd jd  _ ttj }|t"d<t%jd|t|n#t|wxYwt)jrN t+jn8#t$r+}t%jt-|Yd}~nd}~wwxYwjdgdS)NFcNjj|dSdSr_) transportcapture_envelope)enveloperbs rZ_capture_envelopez-_Client._init_impl.._capture_envelopes/~)//99999*)rdrs _experimentsenable_backpressure_handling) capture_func)alwaysneversmallmediumr6z:Invalid value for max_request_body_size. Must be one of {} integrationsdefault_integrationsauto_enabling_integrations) with_defaultswith_auto_enabling_integrationsr-zSetting SDK name to '%s'ru)_client_init_debugrJsetrVrrmonitorr!rsession_flusher ValueErrorformatrrr listkeysSDK_INFOrrsrrrFr)rb old_debugrr6sdk_namer~s` rZraz_Client._init_implsM&**511  : : : : : " .  " "4<#8 9 9 9+DL99DNDL~ ;</332E;$+4>#:#:DL#1?P#Q#Q#QD $J !|34 > >  " "9 - - - -  " "9 - - - -  . . % %t|,,,, % % % SVV$$$$$$$$ % ##DL$4$45I2$N$NOOOOOs$EFF1 G H(!HHc|jdS)z%Returns the configured DSN as string.r2rgrhs rZr2z _Client.dsn s|E""rdc |dtj|d<|b|ddk}||||j}|)|jr |jd|rdnddS|}|jdrd|vrd |vr|d |vrxt5d t|jd d |jdtdd dgi|d <dddn #1swxYwYdD]S}||<|j|/t|j| ||<T|dBtt}t|j|d<||d<|dd|d<t#||jd|jd|jd}|1|jd}|r"|jds|||Bt'||jd|jd}|jd} | ||ddkrqd} t5| ||pi} dddn #1swxYwY| 7t)jd|jr|jdd| }|jd } | ||ddkrqd} t5| ||pi} dddn #1swxYwY| 7t)jd!|jr|jdd| }|S)"N timestamptype transactionevent_processorerror data_categoryattach_stacktrace exception stacktracethreadsvaluesr4Tmax_value_length)r4rF)rcrashedcurrent)r8r9r<distsdkrplatformpythonin_app_excludein_app_includer?rCsend_default_piir6)r6r before_sendzbefore send dropped eventbefore_send_transactionz%before send transaction dropped event)rJrutcnowapply_to_eventrVrrecord_lost_eventrr rrstriprIrsortedrrr scrub_eventrrinfo) rbeventhintscopeis_transactionevent_rWsdk_inforCr new_eventrs rZ_prepare_eventz_Client._prepare_events# 99[ ! ! )!)!2!2E+   "YYv..-?N))%t|DDF~>N44)8F'S}}G5tE L, - 5((E))&&,..  *<8< 8H8H$=t9"9"261A1A$68P2"2" +++(-'+   $i                $C B BCyy~~%$,s*;*G&t|C'899??AAc 99U   #H~~H'-d.?.D.D.F.F'G'GH^ $#E%L 99Z ( (E*   L) * L) * L (     !\*:;N 2dl3E&F 2**5111  &*l&6&67N&O&O!%!1!12D!E!EE l=1  #! &!!]22I,.. ; ;'Ktzr::  ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;  7888>N44%W5E"&,/H"I # /! &!!]22I,.. G G33E4:2FF  G G G G G G G G G G G G G G G  CDDD>N44%]5E s77ADDD K''K+.K+'NN Nc&|d}|dS|d}t|d}|djd|}|jdD]:}t |t r||ks||krdS't ||rdS;dS)Nexc_infoFrro ignore_errorsT)rJr __module__rVrDr issubclass)rbrrrrerror_type_nameerror_full_name ignored_errors rZ_is_ignored_errorz_Client._is_ignored_errors88J''  5 ' 44%-a[%;%;%;__M!\/:  M-66  O33}7W7W448Xe]33 44 urdNc|ddk}|rdS|duo|j }|rdS|||}|rdSdS)NrrTF)rJ_should_capturer)rbrrrrignoring_prevents_recursionignored_by_config_options rZrz_Client._should_capturesr6**m;  4&+4&7&U@U>   ~ W00g0VVV5trdcd}d}d}|dpid}|r9d}|D]4}|d}|r|ddurd}n5|d} |j]|dpid } t| piD]!\} } | d kr| }n"||rd nd| ||j|p|z dS) NFrrT mechanismhandleduserrequestheadersz user-agentr)statusr user_agenterrors)rJrrlowerupdater) rbsessionrrerroredr exceptionsrrrrkvs rZ_update_session_from_eventz"_Client._update_session_from_eventsT ii ,,277AA  G#  !IIk22 y!9!9U!B!B"GEyy     %yy++1r66yAAG!'-R00  17799 ,,!"JE-  '199T!>W%78      rdc|tjdrdS|jdS|i}|d}t|pd}|t jjx|d<}||||sdS|dd}| |||}|dS|r|j nd}|r| |||ddk}|ddk} |s| s| |sdSt|j} |d } |d id pi} | d i} | p|p| pt| }|r|dt!t#jd }| r| |d <t'|}|rF|.||||j||n-| r||n||| pdD])}||*|j|n|j||S)a>Captures an event. :param event: A ready-made event that can be directly sent to Sentry. :param hint: Contains metadata about the event that can be read from `before_send`, such as the original exception object or a HTTP request object. :param scope: An optional scope to use for determining whether this event should be captured. :returns: An event ID. May be `None` if there is no DSN set or of if the SDK decided to discard the event for other reasons. In such situations setting `debug=True` on `init()` may help. FNevent_idprofilerrcheck_in attachmentscontextsrdynamic_sampling_context)rsent_at)r)r rJrrIuuiduuid4hexrpopr_sessionrrrrVboolr rrr add_profileto_jsonadd_transaction add_checkin add_eventadd_itemto_envelope_itemr capture_event)rbrrrrr event_optrr is_checkintracing_enabledr trace_contextrshould_use_envelope_endpointrr attachments rZrz_Client.capture_events$ ! $U + + 4 > !4 <D99Z((DJB  +/:<<+; ;E* ##E477 4))It,,''tU;;  4%*3%..t  <  + +GU ; ; ;"v..-?]]6**j8   --e44  4-dl;;hh}-- ! j"5599'BBHb #0#4#45OQS#T#T  P~ P PtK?P?P % ( 4%j1+HO,=,=>>G ( <#; 000H .&((DL)Q)QRRR((3333 .$$Y////""9---)/R A A !!*"="="?"?@@@@ N + +H 5 5 5 5 N ( ( 3 3 3rdct|jstjddS|j|dS)Nz3Discarded session update because of missing release)r8rrr add_session)rbrs rZcapture_sessionz_Client.capture_sessionHsB 6 KM N N N N N  , ,W 5 5 5 5 5rdc|jr||||j|jr|j|jd|_dSdS)z Close the client and shut down the transport. Arguments have the same semantics as :py:meth:`Client.flush`. Ntimeoutcallback)rflushrkillrrbr r s rZclosez _Client.closeQs| > % JJwJ : : :  % % ' ' '| $ !!### N   ! ! !!DNNN & %rdc|jF| |jd}|j|j||dSdS)a# Wait for the current events to be sent. :param timeout: Wait for at most `timeout` seconds. If no `timeout` is provided, the `shutdown_timeout` option value is used. :param callback: Is invoked with the number of pending events and the configured timeout. Nshutdown_timeoutr )rrVrr rs rZr z _Client.flushcs\ > %,'9:  & & ( ( ( N 8 D D D D D & %rdc|Sr_rrhs rZ __enter__z_Client.__enter__vs rdc.|dSr_)r)rbexc_type exc_valuetbs rZ__exit__z_Client.__exit__zs rdr_)NN)__name__r __qualname____doc__rcrirlrrapropertyr2rrrrrrrrr rrrrdrZr]r]sm  ))) ,,,\3P3P3Pj##X# tttl4 ,$" " " N ____B666""""(EEEE&rdr]ceZdZdS)r`NrrrrrdrZr`r` rdr`ceZdZdS)ClientNrrrdrZr"r"r rdr"ctSr_)r[rrdrZr$s<rdctSr_)r]rrdrZr$r$sgrd)J importlibrrLrrrrOsentry_sdk._compatrrrsentry_sdk.utilsrr r r r r rrrsentry_sdk.serializerrsentry_sdk.tracingrrsentry_sdk.transportrsentry_sdk.constsrrrrrsentry_sdk.integrationsrrsentry_sdk.sessionsrsentry_sdk.envelopersentry_sdk.profilerrrsentry_sdk.scrubberr sentry_sdk.monitorr!sentry_sdk._typesr"typingr#r$r%r&r'sentry_sdk.scoper(r)r*sentry_sdk.sessionr+rrr[ModuleNotFoundErrorrtrR ImportErrorobjectr]rFr`r"rrdrZr:s######  AAAAAAAAAA                      ,+++++99999999//////766666''''''......((((((EEEEEEEE------&&&&&&++++++ +&&&&&&--------****** Z 344 +@@A  GGGT)0)))() lllllflll^,+++++!     'c3h        "G     (''**Koo FFFsC!!C+*C+