관리-도구
편집 파일: flask.cpython-311.pyc
� �܋f� � �� � d dl mZ d dlmZ d dlmZmZ d dlmZm Z d dl mZ d dlm Z d dlmZ d dlmZ d d lmZmZmZ er d d lmZmZmZmZ d dlmZ d dlmZ d d lmZmZ d dl Z n # e!$ r dZ Y nw xY w d dl"m#Z#m$Z$ d dl"m%Z& d dl"m'Z( d dl)m*Z*m+Z+m,Z, d dl-m.Z. n# e!$ r ed� � �w xY w d dl/Z/n# e!$ r ed� � �w xY wdZ0 G d� de � � Z1d� Z2d� Z3d� Z4 G d� de� � Z5d� Z6d� Z7d � Z8dS )!� )�absolute_import)� TYPE_CHECKING)�Hub�_should_send_default_pii)�DidNotEnable�Integration)�RequestExtractor)�SentryWsgiMiddleware)�Scope)�SOURCE_FOR_STYLE)�capture_internal_exceptions�event_from_exception� parse_version)�Any�Callable�Dict�Union)�EventProcessor)�_ScopedResponse)�FileStorage�ImmutableMultiDictN)�Flask�Request)�__version__)�request)�before_render_template�got_request_exception�request_started)�MarkupzFlask is not installedzblinker is not installed)�endpoint�urlc �4 � e Zd ZdZdZdd�Zed� � � ZdS )�FlaskIntegration�flask� r c �\ � |t vrt d|�dt �d�� � �|| _ d S )Nz%Invalid value for transaction_style: z (must be in �))�TRANSACTION_STYLE_VALUES� ValueError�transaction_style)�selfr* s �T/opt/cloudlinux/venv/lib64/python3.11/site-packages/sentry_sdk/integrations/flask.py�__init__zFlaskIntegration.__init__7 sJ � ��$<�<�<��*�$�$�$�&>�&>�&>�@�� � � "3����� c �| �� t t � � } | �'t d� t � � � � �| dk rt d� � �t j t � � t j t � � t j t � � t j ��fd�}|t _ d S )NzUnparsable Flask version: {})r � z Flask 0.10 or newer is required.c � �� � t j � t � � � �� ||� � S t �� fd�� � ||� � S )Nc � �� ��g| �R i |��S �N� )�a�kw�old_appr+ s ��r, �<lambda>zNFlaskIntegration.setup_once.<locals>.sentry_patched_wsgi_app.<locals>.<lambda>W s! �� ����9P��9P�9P�9P�R�9P�9P� r. )r �current�get_integrationr# r )r+ �environ�start_responser7 s ` �r, �sentry_patched_wsgi_appz<FlaskIntegration.setup_once.<locals>.sentry_patched_wsgi_appR s^ ��� ��{�*�*�+;�<�<�D��w�t�W�n�=�=�=�Q�'�(P�(P�(P�(P�(P�Q�Q���� � r. ) r � FLASK_VERSIONr �formatr �connect�_add_sentry_tracer �_request_startedr �_capture_exceptionr �__call__)�versionr= r7 s @r, � setup_oncezFlaskIntegration.setup_once@ s� �� � � �.�.���?��=�D�D�]�S�S�T�T�T��W����A�B�B�B��&�'8�9�9�9��� 0�1�1�1��%�&8�9�9�9��.�� � � � � � 1����r. N)r )�__name__� __module__�__qualname__� identifierr* r- �staticmethodrF r4 r. r, r# r# 2 sN � � � � � ��J���3� 3� 3� 3� �1� 1� �\�1� 1� 1r. r# c � � d|v rd S t j }t |� � � � � }||d<