ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/raven/contrib/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/raven/contrib/__pycache__/sanic.cpython-311.pyc

�

�܋f�����dZddlmZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZej��Ze�d
��Zdd�ZGd�d
e��ZdS)z�
raven.contrib.sanic
~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2018 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
�)�absolute_importN)�
setup_logging)�Client)�
SentryHandler)�urlparse)�
to_unicode)�convert_options�logging_configuredc��|dit|j|t|j�dg����t|jg��zd|id������S)N�SENTRY_INCLUDE_PATHS�app)�dsn�
include_paths�extra)�defaults�)r	�config�set�get�name)�
client_clsr
rs   �d/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/raven/contrib/sanic.py�make_clientrs~���:���
��J����
���'=�r�B�B�C�C��3�8�*�o�o�&��3��
	�	�
�
�
����c��eZdZdZdedddejfd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
		dd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�Sentryaj
    Sanic application for Sentry.

    Look up configuration from ``os.environ['SENTRY_DSN']``::

    >>> sentry = Sentry(app)

    Pass an arbitrary DSN::

    >>> sentry = Sentry(app, dsn='http://public:secret@example.com/1')

    Pass an explicit client::

    >>> sentry = Sentry(app, client=client)

    Automatically configure logging::

    >>> sentry = Sentry(app, logging=True, level=logging.ERROR)

    Capture an exception::

    >>> try:
    >>>     1 / 0
    >>> except ZeroDivisionError:
    >>>     sentry.captureException()

    Capture a message::

    >>> sentry.captureMessage('hello, world!')
    NFc���|r$t|t��std���||_||_||_||_||_||_|�	|��dS)Nz&client should be an instance of Client)
�
isinstancer�	TypeError�clientrr�logging�logging_exclusions�level�init_app)�selfr
r rrr!r"r#s        r�__init__zSentry.__init__Mso���	F�*�V�V�4�4�	F��D�E�E�E����$���������"4�����
��
�
�c�����rc�V�|jsdS	|j�|�|����nC#t$r6}|jj�t
|����Yd}~nd}~wwxYwt|��||jf}|�	|���dS)N)�exc_info)
r �http_context�
get_http_info�	Exception�logger�	exceptionr�type�
__traceback__�captureException)r%�requestr-�e�exception_infos     r�handle_exceptionzSentry.handle_exceptionZs����{�	��F�	8��K�$�$�T�%7�%7��%@�%@�A�A�A�A���	8�	8�	8��K��(�(��A���7�7�7�7�7�7�7�7�����	8����
�y�/�/�9�i�6M�N�����~��6�6�6�6�6s�-9�
A9�,A4�4A9c��|jS�N)�form�r%r1s  r�
get_form_datazSentry.get_form_datag�
���|�rc�v�|�|��r|j}n|j}|�||��S)zR
        Determine how to retrieve actual data by using request.mimetype.
        )�is_json_type�
get_json_datar9�get_http_info_with_retriever)r%r1�	retrievers   rr*zSentry.get_http_infojsB�����W�%�%�	+��*�I�I��*�I��0�0��)�D�D�Drc��|jSr6)�jsonr8s  rr=zSentry.get_json_datatr:rc��tj|j��}	||��}n#t$ri}YnwxYwd�|j|j|j��|j|j	||j
|jd|jid�S)zT
        Exact method for getting http_info but with form data work around.
        z{0}://{1}{2}�REMOTE_ADDR)�url�query_string�method�data�cookies�headers�env)
r�urlsplitrDr+�format�scheme�netloc�path�queryrFrHrI�remote_addr)r%r1r?�urlpartsrGs     rr>z#Sentry.get_http_info_with_retrieverws����$�W�[�1�1��	��9�W�%�%�D�D���	�	�	��D�D�D�	����"�(�(�����(�-�A�A�$�N��n�������w�2��
�
�	
s�'�6�6c�B�|j�d��}|dkS)Nzcontent-typezapplication/json)rIr)r%r1�content_types   rr<zSentry.is_json_type�s#����*�*�>�:�:���1�1�1rc�^�|�||_|�||_|�||_|�d|_n||_|js t|j||j��|_|jrTi}|j�
|j|d<t|j|j���}t|fi|��tj
|fdti|��t|d��si|_||jd<|j
�t|j��|�|jd���|�|jd	���dS)
N)�rootzsanic.accesszsanic.error�exclude)r#�sentry_handler�
extensions�sentryr1)�	attach_to�response)rr#r!r"r rrrrr
�send�hasattrrY�
error_handler�addr+r4�register_middleware�before_request�
after_request)r%r
rr!r#r"�kwargs�handlers        rr$zSentry.init_app�sf���?��D�H����D�J���"�D�L��%�'7�D�#�#�'9�D�#��{�	F�%�d�o�s�D�H�E�E�D�K��<�	>��F��&�2�$(�$;��y�!�#�D�K�t�z�B�B�B�G��'�,�,�V�,�,�,��#��
>�
>�%2�
>�6<�
>�
>�
>��s�L�)�)�	 ��C�N�#'���x� �����i��)>�?�?�?����� 3�y��I�I�I����� 2�j��I�I�I�I�Irc��d|_	|j�|�|����dS#t$r7}|jj�t|����Yd}~dSd}~wwxYwr6)�
last_event_idr r)r*r+r,r-r)r%r1r2s   rrbzSentry.before_request�s���!���	8��K�$�$�T�%7�%7��%@�%@�A�A�A�A�A���	8�	8�	8��K��(�(��A���7�7�7�7�7�7�7�7�7�����	8���s�-8�
A9�,A4�4A9c�n�|jr|j|jd<|jj���dS)NzX-Sentry-ID)rgrIr �context�clear)r%r1r\s   rrczSentry.after_request�s;����	A�.2�.@�H��]�+����!�!�#�#�#�#�#rc�v�|js
Jd���|jj|i|��}|�|��|S)Nz5captureException called before application configured)r r0�set_last_event_id_from_result�r%�argsrd�results    rr0zSentry.captureException�sJ���{�S�S�S�S�S�{�-���-�t�>�v�>�>���*�*�6�2�2�2��
rc�v�|js
Jd���|jj|i|��}|�|��|S)Nz3captureMessage called before application configured)r �captureMessagerlrms    rrqzSentry.captureMessage�sJ���{�Q�Q�Q�Q�Q�{�+���+�T�<�V�<�<���*�*�6�2�2�2��
rc�Z�|r!|j�|��|_dSd|_dSr6)r �	get_identrg)r%ros  rrlz$Sentry.set_last_event_id_from_result�s6���	&�!%��!6�!6�v�!>�!>�D����!%�D���rc�H�|js
Jd���|jj|i|��S)Nz1user_context called before application configured)r �user_context�r%rnrds   rruzSentry.user_context��2���{�O�O�O�O�O�{�'�t�{�'��8��8�8�8rc�H�|js
Jd���|jj|i|��S)Nz1tags_context called before application configured)r �tags_contextrvs   rryzSentry.tags_context�rwrc�H�|js
Jd���|jj|i|��S)Nz2extra_context called before application configured)r �
extra_contextrvs   rr{zSentry.extra_context�s2���{�P�P�P�P�P�{�(�t�{�(�$�9�&�9�9�9r)NNNN)�__name__�
__module__�__qualname__�__doc__rr!�NOTSETr&r4r9r*r=r>r<r$rbrcr0rqrlruryr{rrrrr-s:��������>$(�F���4�w�~�����7�7�7����E�E�E����
�
�
�02�2�2�;?�$(�#J�#J�#J�#J�J8�8�8�$�$�$�
������&�&�&�9�9�9�9�9�9�:�:�:�:�:rrr6)r�
__future__rr!�blinker�
raven.confr�
raven.baser�raven.handlers.loggingr�raven.utils.compatr�raven.utils.encodingr�raven.utils.confr	�	Namespace�
raven_signals�signalr
r�objectrrrr�<module>r�s����'�&�&�&�&�&���������$�$�$�$�$�$�������0�0�0�0�0�0�'�'�'�'�'�'�+�+�+�+�+�+�,�,�,�,�,�,�"��!�#�#�
�"�)�)�*>�?�?������$s:�s:�s:�s:�s:�V�s:�s:�s:�s:�s:r

Zerion Mini Shell 1.0