\!* T d dl mZ d dlmZ d dlmZmZ d dlmZ d dl m Z d dlmZm Z d dlmZ erd dlmZ d d lmZ d d lmZ d dlmZ d dlZd dlZd d lmZ n# e$ r ed w xY w G d de Z G d de ZdZ G d de Zd Zd Z d Z!d Z"d Z#dS ) )absolute_import)Hub)IntegrationDidNotEnable)RequestExtractor)SentryWsgiMiddleware)capture_internal_exceptionsevent_from_exception)MYPY)Any)Dict)Optional)EventProcessorN)__version__zFalcon not installedc 2 e Zd Zd Zd Zd Zd Zd Zd ZdS )FalconRequestExtractorc | j j S N)requestenvselfs ~/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/sentry_sdk/integrations/falcon.pyr zFalconRequestExtractor.env s | c | j j S r )r cookiesr s r r zFalconRequestExtractor.cookies s |##r c d S r r s r formzFalconRequestExtractor.form$ tr c d S r r r s r fileszFalconRequestExtractor.files( r r c > | }|dk rdS d S )Nr z[REQUEST_CONTAINING_RAW_DATA])content_length)r r$ s r raw_datazFalconRequestExtractor.raw_data, s+ ,,..A224r c h | j j S # t j j $ r | j j cY S w xY wr )r mediafalconerrorsHTTPBadRequest_mediar s r jsonzFalconRequestExtractor.json9 sE '<%%}+ ' ' ' <&&&& 's 11N) __name__ __module____qualname__r r r r" r% r, r r r r r sn $ $ $ ' ' ' ' 'r r c e Zd ZdZd ZdS )SentryFalconMiddlewarez9Captures exceptions in Falcon requests and send to Sentryc t j }| t }|d S | 5 }d|_ | t || d d d d S # 1 swxY w Y d S )Nr( )r currentget_integrationFalconIntegrationconfigure_scope_nameadd_event_processor_make_request_event_processor)r reqrespargskwargshubintegrationscopes r process_requestz&SentryFalconMiddleware.process_requestH