관리-도구
편집 파일: asgi.cpython-37.opt-1.pyc
B T a! � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z m Z ddlmZ ddl mZmZmZmZmZ ddlmZ er�dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZmZ ed�ZdZdd� Z dd� Z!G dd� d�Z"dS )zf An ASGI middleware. Based on Tom Christie's `sentry-asgi <https://github.com/encode/sentry-asgi>`_. � N)�partial)�MYPY)�Hub�_should_send_default_pii)�_filter_headers)� ContextVar�event_from_exception�transaction_from_function�HAS_REAL_CONTEXTVARS�CONTEXTVARS_ERROR_MESSAGE)�Transaction)�Dict)�Any)�Optional)�Callable)�Literal)�Event�HintZsentry_asgi_middleware_appliedzgeneric ASGI requestc C s8 | j d k r4t|| j jddd�d�\}}| j||d� d S )N�asgiF)�typeZhandled)Zclient_optionsZ mechanism)�hint)�clientr �optionsZ capture_event)�hub�exc�eventr � r �M/opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/integrations/asgi.py�_capture_exception( s r c C sB t �| �rt| d�S t �| �r(t�| �S t| dd�}t�|�S dS )z� Try to figure out if an application object supports ASGI3. This is how uvicorn figures out the application version as well. � __await__�__call__N)�inspectZisclass�hasattrZ isfunction�asyncioZiscoroutinefunction�getattr)�app�callr r r �_looks_like_asgi35 s r'