0ijddlZddlZddlmZddlmZmZmZmZm Z ddl m Z m Z m Z mZddlmZddlmZddlmZer6ddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZmZmZddl m!Z!m"Z" ddlm#Z#m$Z$m%Z%m&Z'm(Z)dZ+Gdde Z,GddeZ-dZ.dZ/dZ0y#e*$r e dwxYw)N)SOURCE_FOR_STYLE)capture_internal_exceptionsensure_integration_enabledevent_from_exception parse_versiontransaction_from_function) Integration DidNotEnable$_DEFAULT_FAILED_REQUEST_STATUS_CODES_check_minimum_version)SentryWsgiMiddleware)RequestExtractor) TYPE_CHECKING)Set)_ScopedResponse)Any)Dict)Callable)Optional) FileUpload FormsDict LocalRequest)EventProcessorEvent)Bottle HTTPResponseRouterequest __version__zBottle not installed)endpointurlc>eZdZdZdeZdZ deddZedZ y) BottleIntegrationbottlez auto.http.)failed_request_status_codesc\|tvrtd|dtd||_||_y)Nz%Invalid value for transaction_style: z (must be in ))TRANSACTION_STYLE_VALUES ValueErrortransaction_styler&)selfr+r&s M/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/integrations/bottle.py__init__zBottleIntegration.__init__8s8 $< <$&>@ "3+F(ctt}tt|tj t tfd}|t_tjtjfd}|t_tjtjfd}|t_ y)NcVtfdtj}|||S)Ncg|i|SN)akwold_appr,s r-zOBottleIntegration.setup_once..sentry_patched_wsgi_app..Ts!8!8R!8r/) span_origin)r r#origin)r,environstart_response middlewarer7s` r-sentry_patched_wsgi_appz=BottleIntegration.setup_once..sentry_patched_wsgi_appPs*.8-44J g~6 6r/ctjjt}| ||Stj}d|_|j t|t|||}|S)Nr$) sentry_sdk get_clientget_integrationr#get_isolation_scope_nameadd_event_processor_make_request_event_processorbottle_request)r,r; integrationscoperes old_handles r-_patched_handlez5BottleIntegration.setup_once.._patched_handle^st%//1AABSTK"!$00224E"EK  % %-dNKP T7+CJr/c|g|i|tjjtSfd}|S)Nc |i|}t|tr%|jj vr t|d|S#t$r}t|d|d}~wwxYw)NF)handledT) Exception_capture_exception isinstancer status_coder&)argskwargsrJ exceptionrHprepared_callbacks r-wrapped_callbackzUBottleIntegration.setup_once..patched_make_callback..wrapped_callback{se$+T.patched_make_callbackrsM!2$ H H H $//1AABSTK"((  $ #r/) rBOTTLE_VERSIONr r#r__call__r_handle functoolswrapsr_make_callback)versionr>rLrZr7rKrYs @@@r- setup_oncezBottleIntegration.setup_onceHs /0':// #$5w ? 7 @ 72^^  $  % )!00 * + $ , $4 5r/N)r ) __name__ __module__ __qualname__ identifierr:r+r r. staticmethodrbr4r/r-r#r#2sFJ* &F%G%I G D5D5r/r#c0eZdZdZdZdZdZdZdZy)BottleRequestExtractorc.|jjSr3)rr;r,s r-envzBottleRequestExtractor.env||###r/c.|jjSr3)rcookiesrks r-rozBottleRequestExtractor.cookiesrmr/cJ|jjjSr3)rbodyreadrks r-raw_datazBottleRequestExtractor.raw_datas||  %%''r/cl|jry|jjjSr3)is_jsonrformsdecoderks r-formzBottleRequestExtractor.forms' <<>||!!((**r/cP|jry|jjSr3)rurfilesrks r-rzzBottleRequestExtractor.filess <<>||!!!r/c|jSr3)content_length)r,files r- size_of_filez#BottleRequestExtractor.size_of_files"""r/N) rcrdrerlrorsrxrzr~r4r/r-riris $$(+ "#r/ric.d}|dk(r |jjxsd}nA|dk(r< |jjxs#t |jj xsd}||d<dt |i|d<y#t$rYwxYw#t$rY.wxYw)Nr%r!r transactionsourcetransaction_info)routerule RuntimeErrornamercallbackr)eventr+rrs r- _set_transaction_name_and_sourcers DE! ==%%+D j (  "",W]]-C-CD  E-!)+;.event_processorsG( 0M0MwW ( * "7 + > >u E+ + s AAr4)apprrHrs `` r-rFrFs r/ct|tjjd|d\}}tj||y)Nr$)typerO)client_options mechanism)r)rr@rAoptions capture_event)rVrOrrs r-rQrQs?&!,,.66#8KE4 U.r/)1r^r@sentry_sdk.tracingrsentry_sdk.utilsrrrrrsentry_sdk.integrationsr r r r sentry_sdk.integrations.wsgir $sentry_sdk.integrations._wsgi_commonrtypingrcollections.abcrrrrrrr$rrrsentry_sdk._typesrrrrrrrGrr[ ImportErrorr)r#rirrFrQr4r/r-rs/ >A #<::7 //[5 [5|#-#>P0 /W/ - ../s 4B$$B2