ok

Mini Shell

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

�

�܋f�u��<�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
m
Z
ddlmZddl
mZddlmZddlmZejd	krddlZnddlZ	dd
lmZn#e$r	dd
lmZYnwxYwddlZddlmZddlmZdd
l m!Z!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5m6Z6ddl7ZdZ8da9dZ:dej;d�Z<da=ejd	kre>Z?d�Z@Gd�deA��ZBGd�deC��ZDGd�deC��ZEGd �d!eE��ZFdS)"z�
raven.base
~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
�)�absolute_importN)�datetime��isclass)�Random)�FunctionType)�local)��)�	get_ident)�defaults)�RemoteConfig)�APIError�RateLimited)�json�get_versions�get_auth_header�merge_dicts)�	text_type�	iteritems)�
to_unicode)�	transform)�get_stack_info�iter_stack_frames)�TransactionStack)�TransportRegistry�default_transports)�Client�pythonzraven-python)�name�versionc�8�ttjdd��S)N�raven_client)�getattr�sys�
excepthook���A/opt/cloudlinux/venv/lib64/python3.11/site-packages/raven/base.py�get_excepthook_clientr*Es���3�>�>�4�8�8�8r(c��eZdZd�ZdS)�ModuleProxyCachec��|�dd��\}}tt|ii|g��|��}|||<|S)N�.�)�rsplitr$�
__import__)�self�key�module�
class_name�handlers     r)�__missing__zModuleProxyCache.__missing__JsS�� �Z�Z��Q�/�/���
��*��B��Z�L�*�*�+5�7�7����S�	��r(N)�__name__�
__module__�__qualname__r7r'r(r)r,r,Is#����������r(r,c�6�eZdZdZdZd�Zd�Zd	d�Zd�Zd�Z	dS)
�ClientStater/rc�H�|j|_d|_d|_d|_dS�Nr��ONLINE�status�
last_check�retry_number�retry_after�r2s r)�__init__zClientState.__init__Y�(���k�������������r(c��|j|jkrdS|jpt|jd��dz}tj��|jz
|krdSdS)NT�rF)rAr@rD�minrC�timerB)r2�intervals  r)�
should_tryzClientState.should_try_sW���;�$�+�%�%��4��#�E�s�4�+<�a�'@�'@�A�'E���9�;�;���(�8�3�3��4��ur(c�|�|j|_|xjdz
c_tj��|_||_dS)Nr/)�ERRORrArCrKrBrD)r2rDs  r)�set_failzClientState.set_failjs:���j������Q�����)�+�+���&����r(c�H�|j|_d|_d|_d|_dSr>r?rEs r)�set_successzClientState.set_successprGr(c�"�|j|jkS�N)rArOrEs r)�did_failzClientState.did_failvs���{�d�j�(�(r(N)r)
r8r9r:r@rOrFrMrPrRrUr'r(r)r<r<Usn������
�F�
�E����	�	�	�'�'�'�'����)�)�)�)�)r(r<c���eZdZdZejd��ZdZee	���Z
				d4d�Zd	�Zd5d
�Z
d�Zd�Zd
�Zed���Zd�Zd�Zd�Zd�Zd6d�Zd�Zd�Zd�Z			d7d�Zd�Zed���Zd�Zd�Z d�Z!d�Z"		d8d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(d6d$�Z)d6d%�Z*d6d&�Z+d'�Z,d(�Z-d)�Z.d*�Z/d6d+�Z0d,�Z1d6d-�Z2d9d/�Z3d0�Z4d1�Z5e5Z6ed2���Z7e7j8d3���Z7dS):raU
    The base Raven client.

    Will read default configuration from the environment variable
    ``SENTRY_DSN`` if available.

    >>> from raven import Client

    >>> # Read configuration from ``os.environ['SENTRY_DSN']``
    >>> client = Client()

    >>> # Specify a DSN explicitly
    >>> client = Client(dsn='https://public_key:secret_key@sentry.local/project_id')

    >>> # Record an exception
    >>> try:
    >>>     1/0
    >>> except ZeroDivisionError:
    >>>     ident = client.get_ident(client.captureException())
    >>>     print "Exception caught; reference is %s" % ident
    �raven�6)�
transportsNFTc	�
�|	}
t��|_||_|j}t	��|_t
j|j�d|j	����|_
t
jd��|_t
jd��|_i|_
|�||��t|
�d��pg��|_t|
�d��pg��|_t'|
�d��p?t(j�d��p |
�d��pt,j��|_t3|
�d	��pt,j��|_t3|
�d
t,j����|_t=|
�d��pt,j��|_ t=|
�d��pt,j!��|_"|
�d
��|_#|
�dd��|_$|
�d��|_%|
�d��|_&|j%�t,j'|_%|
�d��}|� dtQtRdg��dd�i}||_*|
�d��pi|_+|
�d��pt(j�dd��|_,|
�d��p=t(j�d��pt(j�d��|_-|�.|
�d����|_/|
�d���|
�d��nd|_0tc��|_2t|
�d��pd��|_3ti��|_5tm|��|_7|�8��s|j
�9d ��tt�|a:tw��|_<||_=d!d"l>m?}
|
|��|_@|r|�A��|r|�B��|�C|��dS)#Nr.z
sentry.errorszsentry.errors.uncaught�
include_paths�
exclude_pathsr �SENTRY_NAME�machine�auto_log_stacks�capture_locals�string_max_length�list_max_length�site�include_versionsT�
processors�
sanitize_keys�contextzsys.argv�argv�tags�environment�SENTRY_ENVIRONMENT�release�SENTRY_RELEASE�HEROKU_SLUG_COMMIT�repos�sample_rater/�ignore_exceptionsr'zaRaven is not configured (logging is disabled). Please see the documentation for more information.r)�Context)Dr	�_local_state�raise_send_errors�	__class__r<�state�logging�	getLoggerr9r8�logger�error_logger�uncaught_logger�_transport_cache�set_dsn�set�getr[r\r�os�environr
�NAMEr �bool�AUTO_LOG_STACKSr_�CAPTURE_LOCALSr`�int�MAX_LENGTH_STRINGra�MAX_LENGTH_LISTrbrcrdrerf�
PROCESSORSr$r%�extrarirjrl�
_format_reposrorpr�transactionrqr,�module_cacher�_random�
is_enabled�info�Raven�get_thread_ident�main_thread_id�enable_breadcrumbs�
raven.contextrr�_context�install_sys_hook�install_logging_hook�hook_libraries)r2�dsnrt�	transportr�r�r�r��_random_seed�options�o�clsrgrrs              r)rFzClient.__init__�sf��
��!�G�G���!2����n�� �]�]��
��'��~�~�~�s�|�|�4�6�6���#�-�o�>�>���&�0�1I�J�J��� "������S�)�$�$�$� �����!7�!7�!=�2�>�>��� �����!7�!7�!=�2�>�>����
�E�E�&�M�M�
1�R�Z�^�^�M�:�:�
1��u�u�Y���
1�#+�=�
�
��	� $�
�E�E�#�$�$�@��(@� 
� 
���#�
�E�E�"�H�$;�<�<�>�>���!$�
�E�E�%�&�&�D�(�*D�"F�"F���"�
�E�E�#�$�$�@��(@� B� B����E�E�&�M�M��	� !���&8�$� ?� ?����%�%��-�-����U�U�?�3�3����?�"�&�1�D�O��%�%�	�"�"���?�!�7�3���#;�#;�A�A�A�#>�?�G���
��E�E�&�M�M�'�R��	�
�E�E�-� � �N�B�J�N�N�3G��$N�$N�	
��
�E�E�)���
4��
���/?� @� @�
4��z�~�~�2�3�3�	
���'�'����g���7�7��
��u�u�]�#�#�/�
�E�E�-� � � ��	
��
,�-�-���!$�Q�U�U�+>�%?�%?�%E�2�!F�!F���,�.�.����l�+�+������ � �	8��K���7�
8�
8�
8��=��E�/�0�0���"4���)�)�)�)�)�)����
�
��
��	$��!�!�#�#�#��	(��%�%�'�'�'����N�+�+�+�+�+r(c��i}|rWt|��D]G\}}|ddkr1tj�t	|��j��}|||<�H|S)Nr�/)rr��path�abspathr1�__file__)r2�value�resultr��configs     r)r�zClient._format_repos�se�����	&� )�%� 0� 0�
&�
&���f���7�c�>�>��7�?�?�:�d�+;�+;�+D�E�E�D�%��t����
r(c��|sMtj�d��r.d}|j�|��tjd}||jvrA|st
|���}nt
j|||j���}||j|<||_	n|j||_	|j�d�
|j	����dS)N�
SENTRY_DSNz8Configuring Raven from environment variable 'SENTRY_DSN')r�)r��transport_registryzConfiguring Raven for host: {0})r�r�rry�debugr|r�from_string�	_registry�remote�format)r2r�r��msgr�s     r)r}zClient.set_dsn�s����	+�r�z�~�~�l�3�3�	+�L�C��K���c�"�"�"��*�\�*�C��d�+�+�+��
�%�	�:�:�:���%�1��'�'+�~�����
*0�D�!�#�&� �D�K�K��/��4�D�K�����;�B�B�4�;�O�O�P�P�P�P�Pr(c�^��t�tja�fd�}�|_|t_dS)Nc�H����|d���t|�dS)N�fatal)�exc_info�level)�captureException�__excepthook__)r�r2s �r)�handle_exceptionz1Client.install_sys_hook.<locals>.handle_exceptions-����!�!�8�7�!�C�C�C��H�%�%�%�%r()r�r%r&r#)r2r�s` r)r�zClient.install_sys_hooksA����!� �^�N�	&�	&�	&�	&�	&�)-��%�)����r(c�&�ddlm}|��dS)Nr)r�)�raven.breadcrumbsr�)r2r�s  r)r�zClient.install_logging_hooks)��:�:�:�:�:�:�������r(c�(�ddlm}||��dS)Nr)r�)r�r�)r2�	librariesr�s   r)r�zClient.hook_libraries"s*��4�4�4�4�4�4���y�!�!�!�!�!r(c�<�|j�||��dSrT)r��register_scheme)r��scheme�transport_classs   r)r�zClient.register_scheme&s ���
�%�%�f�o�>�>�>�>�>r(c#�NK�|jD]}|j||��V��dSrT)rer�)r2�	processors  r)�get_processorszClient.get_processors*sB������	5�	5�I�.�$�#�I�.�t�4�4�4�4�4�4�	5�	5r(c��|jsiStj}t|j��}d�|d|d|d��|d<|S)Nz{0}.{1}.{2}rr/rr)rdr%�version_inforr[r�)r2r��moduless   r)�get_module_versionszClient.get_module_versions.s^���$�	��I��'���t�1�2�2��)�0�0���O�\�!�_�l�1�o�
�
�����r(c�:�tjdt��|S)z�
        Returns a searchable string representing a message.

        >>> result = client.capture(**kwargs)
        >>> ident = client.get_ident(result)
        zVClient.get_ident is deprecated. The event ID is now returned as the result of capture.)�warnings�warn�DeprecationWarning)r2r�s  r)rzClient.get_ident;s'��	�
�;�(�	*�	*�	*��
r(c�.�|j||��SrT)r�)r2r s  r)�get_handlerzClient.get_handlerGs��&�t� ��&�t�,�,�,r(c�v�|���r$|j���}|r|�d|��S|SdS)z�
        Returns a public DSN which is consumable by raven-js

        >>> # Return scheme-less DSN
        >>> print client.get_public_dsn()

        >>> # Specify a scheme to use (http or https)
        >>> print client.get_public_dsn('https')
        �:N)r�r��get_public_dsn)r2r��urls   r)r�zClient.get_public_dsnJsQ���?�?���	��+�,�,�.�.�C��
/�"(�&�&�#�#�.�.��J�	�	r(c��dx}}	t|do|djj��}|dr
|djpd}n#tt
f$rYnwxYw|dt|d��|t|d��|fS)Nrrr/)�id�tb_frame�f_code�tb_lasti�AttributeError�
IndexError)r2r��code_id�last_ids    r)�_get_exception_keyzClient._get_exception_key[s������'�	���!��D��!��)=�)D�E�E�G��q�k�:�h�q�k�&:�?�a�G�G���
�+�	�	�	��D�	����
�Q�K��x��{�O�O���x��{�O�O��
�	
s�>A�A�Ac�H�|�|��}||jjvSrT)r�rg�exceptions_to_skip�r2r�r3s   r)�skip_error_for_loggingzClient.skip_error_for_loggingls%���%�%�h�/�/���d�l�5�5�5r(c�n�|�|��}|jj�|��dSrT)r�rgr��addr�s   r)�record_exception_seenzClient.record_exception_seenps4���%�%�h�/�/����'�+�+�C�0�0�0�0�0r(c
�.
��tj��j}t|jj|��}|�di��|�di��d|vrd|z}|�|��}|jd#i|
��}
|
�	dd��}|�
d��r|d}t|
��D]\}}||vr|||<�|�d|vr|j}|rLd|vrH|d	urt��}n|}t||j|j�
��}|�d|i��|jr�|�|��D]�}|�
d����|�
d����s�0��d
��rd|d<�Kt+�fd�|jD����o t+�fd�|jD����|d<��d}|s|j���}|�
d��s$|
�
d��pt2j|d<|�
d��s
|j|d<|�
d��s|���|d<|j�
|j|d<|j�
|j|d<t|j|d|��|d<t|j |d|��|d<|�	dd��p|j!}|r|d�d|��|r||d<n|r||d<|	r|	|d<|�"��D]*}|�|�#|�����+d|vr,|
�
d|�$|����|d<t|d��D]\}}tK|��|d|<�t|d��D]#\}}|�|��|d|<�$|�d|j&j'��|�d|ptQj)����|�d|��|�d|��|�dtT��|�dtV��|�d |j,��|j-r8|jj.�/��}|r|�d!d"|i��|S)$z�
        Captures, processes and serializes an event into a dict object

        The result of ``build_msg`` should be a standardized dict, with
        all default values available.
        rir�r.zraven.events.%s�culpritN�	exception�
stacktraceT)�transformerr`�in_appr4zraven.Fc3�B�K�|]}��|��V��dSrT��
startswith��.0�xr�s  �r)�	<genexpr>z#Client.build_msg.<locals>.<genexpr>�s/�����K�K�1�D�O�O�A�.�.�K�K�K�K�K�Kr(c3�B�K�|]}��|��V��dSrTr�r�s  �r)r�z#Client.build_msg.<locals>.<genexpr>�s/�����#S�#S�1�D�O�O�A�$6�$6�#S�#S�#S�#S�#S�#Sr(r��server_namer�rlrjrcr��fingerprint�message�project�	timestamp�
time_spent�event_id�platform�sdkro�breadcrumbs�valuesr')0�uuid�uuid4�hexrrg�data�
setdefaultr��capture�poprrr_rrrr`�updater[�_iter_framesr��anyr\r��peekrwrOr r�rlrjrir�rcr��process�	to_stringrr�r�r�utcnow�
PLATFORM_NAME�	SDK_VALUEror�r��
get_buffer)r2�
event_typer��dater�r��stack�
public_keyrir��kwargsr�r6r�r��k�v�frames�
stack_info�framer�rcr�r3r��crumbsr�s                          @r)�	build_msgzClient.build_msgts�����:�<�<�#���4�<�,�d�3�3�������#�#�#������$�$�$��j� � �*�Z�7�J��"�"�:�.�.�� ���*�*�6�*�*���*�*�Y��-�-���8�8�I���	&��9�o�G��f�%�%�	�	�D�A�q���}�}���Q���
�=�[��4�4��(�E��	�\��-�-���}�}�*�,�,�����'�� �N�#�2����J�

�K�K��j��
�
�
���	��*�*�4�0�0�
�
���9�9�X�&�&�2���y�y��*�*������?�?�8�,�,��&+�E�(�O�O��K�K�K�K��8J�K�K�K�K�K�T� #�#S�#S�#S�#S��@R�#S�#S�#S� S� S�S��(�O�O�
���	2��*�/�/�1�1�K��x�x�� � �	A�"�J�J�w�/�/�@�7�=�D��M��x�x�
�&�&�	,�"&�)�D����x�x�	�"�"�	9�"�6�6�8�8�D��O��<�#�"�l�D��O���'�"&�"2�D���"�4�9�d�6�l�D�A�A��V��#�D�J��W�
�u�E�E��W�
��x�x���%�%�2�����	2���L�#�#�F�D�1�1�1��	&�"-�D����
�	&�%�D��O��	.�"-�D����,�,�.�.�	1�	1�I��K�K�	�)�)�$�/�/�0�0�0�0��D� � �$�j�j��G�4E�4E�d�4K�4K�L�L�D��O�$�D��L�1�1�	2�	2�J�C�� *�5� 1� 1�D��L�����d�7�m�,�,�	1�	1�D�A�q�#�~�~�a�0�0�D��M�!���	
���	�4�;�#6�7�7�7�����T�%>�X�_�->�->�?�?�?�����j�1�1�1����
�H�-�-�-����
�M�2�2�2�����y�)�)�)�������,�,�,��"�		��\�-�8�8�:�:�F��
�
���
��f�0�����r(c�:�t||j|j���S)N)rbra)rrbra�r2r�s  r)rzClient.transforms'����$�"6�"�4�6�6�6�	6r(c��|jS)aT
        Updates this clients thread-local context for future events.

        >>> def view_handler(view_func, *args, **kwargs):
        >>>     client.context.merge(tags={'key': 'value'})
        >>>     try:
        >>>         return view_func(*args, **kwargs)
        >>>     finally:
        >>>         client.context.clear()
        )r�rEs r)rgzClient.context
s���}�r(c�:�|j�d|i��S)z{
        Update the user context for future events.

        >>> client.user_context({'email': 'foo@example.com'})
        �user�rg�mergers  r)�user_contextzClient.user_contexts(���|�!�!��D�#
���	r(c�:�|j�d|i��S)z|
        Update the http context for future events.

        >>> client.http_context({'url': 'http://example.com'})
        �requestr�r2r�rs   r)�http_contextzClient.http_context"s(���|�!�!��t�#
���	r(c�:�|j�d|i��S)zo
        Update the extra context for future events.

        >>> client.extra_context({'foo': 'bar'})
        r�rr#s   r)�
extra_contextzClient.extra_context,s(���|�!�!��T�#
���	r(c�:�|j�d|i��S)zr
        Update the tags context for future events.

        >>> client.tags_context({'version': '1.0'})

        rirr#s   r)�tags_contextzClient.tags_context6s(���|�!�!��D�#
���	r(c	��|���sdS|	�d��}
|
�w|�|
��rdS|�|
��s6|j�d|
dt
j�����dS|�|
��|j	||||||fd|i|	��}|�|j
}|j���|kr
|j
di|��|d|j_|dS)	a�
        Captures and processes an event and pipes it off to SentryClient.send.

        To use structured data (interfaces) with capture:

        >>> capture('raven.events.Message', message='foo', data={
        >>>     'request': {
        >>>         'url': '...',
        >>>         'data': {},
        >>>         'query_string': '...',
        >>>         'method': 'POST',
        >>>     },
        >>>     'logger': 'logger.name',
        >>> }, extra={
        >>>     'key': 'value',
        >>> })

        The finalized ``data`` structure contains the following (some optional)
        builtin values:

        >>> {
        >>>     # the culprit and version information
        >>>     'culprit': 'full.module.name', # or /arbitrary/path
        >>>
        >>>     # all detectable installed modules
        >>>     'modules': {
        >>>         'full.module.name': 'version string',
        >>>     },
        >>>
        >>>     # arbitrary data provided by user
        >>>     'extra': {
        >>>         'key': 'value',
        >>>     }
        >>> }

        :param event_type: the module path to the Event class. Builtins can use
                           shorthand class notation and exclude the full module
                           path.
        :param data: the data base, useful for specifying structured data
                           interfaces. Any key which contains a '.' will be
                           assumed to be a data interface.
        :param date: the datetime of this event
        :param time_spent: a integer value representing the duration of the
                           event (in milliseconds)
        :param extra: a dictionary of additional standard metadata
        :param stack: a stacktrace for the event
        :param tags: dict of extra tags
        :param sample_rate: a float in the range [0, 1] to sample this message
        :return: a 32-length string identifying this event
        Nr�z*Not capturing exception due to filters: %sr)r�rir�r')r�rr��should_captureryr�r%r�r�rrpr��random�sendrs�
last_event_id)r2r
r�rr�r�rrirprr�s           r)rzClient.captureAsA��j��� � �	��F��:�:�j�)�)�����*�*�8�4�4�
����(�(��2�2�
��� � �@�(�1�+� �\�^�^�!�-�-�-����&�&�x�0�0�0��t�~���d�J��u���CG������
���*�K��<��� � �;�.�.��D�I�������*.�z�*:���'��J��r(c�4�|j���S)zg
        Return a boolean describing whether the client should attempt to send
        events.
        )r��	is_activerEs r)r�zClient.is_enabled�s��
�{�$�$�&�&�&r(c#�K�d|vr|ddD]}|V��d|vr5|dddd�dg��D]}|V��dSdS)Nr�rr�r����)r)r2r�rs   r)rzClient._iter_frames�s������4����l�+�H�5�
�
��������$����k�*�8�4�R�8��F�J�J�8�UW�X�X�
�
���������
�
r(c�8�|j���dSrT)rvrRrEs r)�_successful_sendzClient._successful_send�s���
��� � � � � r(c�v�d}t|t��rPt|t��r|j}|j�dt
|��j|j��n!|j�d||dd|i���|�	|��|j
�|���dS)Nrz*Sentry responded with an API error: %s(%s)z,Sentry responded with an error: %s (url: %s)Tr�)r�r�)rD)�
isinstancerrrDrz�error�typer8r��_log_failed_submissionrvrP)r2�excr�r�rDs     r)�_failed_sendzClient._failed_send�s������c�8�$�$�	��#�{�+�+�
.�!�o����#�#�<��S�	�	�"�C�K�
1�
1�
1�
1�
��#�#�>��S���t�n�	
$�
�
�
�	
�#�#�D�)�)�)��
�����4�4�4�4�4r(c
��|�dd��}|g}d|vr�d|dddvr�|dddd�dg��D]Z}|�d|�d	d
��|�dd��|�dd
��d�z���[|j�|��dS)zj
        Log a reasonable representation of an event that should have been sent
        to Sentry
        r�z<no message value>r�r�r�r1rz-  File "%(fn)s", line %(lineno)s, in %(func)s�filename�unknown_filename�lineno�function�unknown_function)�fnr>�funcN)rr�appendr{r6)r2r�r��outputrs     r)r8zClient._log_failed_submission�s���
�(�(�9�&:�;�;������$���<�4��3D�X�3N�r�3R�#R�#R��k�*�8�4�R�8��F�J�J�8�UW�X�X�
�
���
�
�M��)�)�J�0B�C�C�#�i�i��"�5�5�!�I�I�j�2D�E�E�Q�Q������	
��"�"�6�*�*�*�*�*r(c�:����|�i}�jsE�j���s,�����������dS�j�dt���������fd�}	�j�	��}|j
r |���|�j|��dS|�
��|������dS#t$r}�jr�||��Yd}~dSd}~wwxYw)Nz"Sending message of length %d to %sc�\����|��������dSrT)r:�decode)�er�r2r�s ���r)�failed_sendz'Client.send_remote.<locals>.failed_send�s-������a��d�k�k�$�&7�&7�8�8�8�8�8r()rtrvrMrGr8ryr��lenr��
get_transport�is_async�
async_sendr3r,�	Exception)r2r�r��headersrIr�rHs```    r)�send_remotezClient.send_remote�sh������?��G��%�	�d�j�.C�.C�.E�.E�	��;�;�t�$�$�D��'�'��-�-�-��F�����>��D�	�	�3�O�O�O�	9�	9�	9�	9�	9�	9�	9�	���1�1�3�3�I��!�
(��$�$�S�$���9N�%0�2�2�2�2�2����s�D�'�2�2�2��%�%�'�'�'�'�'���	�	�	��%�
���K��N�N�N�N�N�N�N�N�N�����	���s�>C2�+C2�2
D�<D�Dc�Z�|�|��}|�||���S)zV
        Serializes the message and passes the payload onto ``send_encoded``.
        )�auth_header)�encode�send_encoded)r2rRr�r�s    r)r,zClient.send�s.���+�+�d�#�#��� � ��k� �B�B�Br(c��dtj��}|s@tj��}t|j|||jj|jj���}|||���dd�}|j	d|jj
||d�|��S)z
        Given an already serialized message, signs the message and passes the
        payload off to ``send_remote``.
        z
raven-python/)�protocolr��client�api_key�
api_secretzapplication/octet-stream)z
User-Agentz
X-Sentry-AuthzContent-EncodingzContent-Type)r�r�rOr')rW�VERSIONrKr�protocol_versionr�r�
secret_key�get_content_encodingrP�store_endpoint)r2r�rRr�
client_stringr�rOs       r)rTzClient.send_encoded�s����
.3�]�]�<�
��	��	���I�)��.�#�$���.��;�1����K�(�(� $� 9� 9� ;� ;�6�	
�
�� �t��
���*���
�
��	
�
�	
r(c��dS)N�deflater'rEs r)r]zClient.get_content_encodings���yr(c�t�tjtj|���d����S)z8
        Serializes ``data`` into a raw string.
        �utf8)�zlib�compressr�dumpsrSrs  r)rSz
Client.encodes,���}�T�Z��-�-�4�4�V�<�<�=�=�=r(c�t�tjtj|���d����S)z2
        Unserializes a string, ``data``.
        rc)r�loadsrd�
decompressrGrs  r)rGz
Client.decodes,���z�$�/�$�/�/�6�6�v�>�>�?�?�?r(c� �|jdd|i|��S)zr
        Creates an event from ``message``.

        >>> client.captureMessage('My event just happened!')
        �raven.events.Messager�)rk�r)r2r�rs   r)�captureMessagezClient.captureMessages!���t�|�N�N�G�N�v�N�N�Nr(c�T�|�|durtj��}|j	dd|i|��S)a�
        Creates an event from an exception.

        >>> try:
        >>>     exc_info = sys.exc_info()
        >>>     client.captureException(exc_info)
        >>> finally:
        >>>     del exc_info

        If exc_info is not provided, or is set to True, then this method will
        perform the ``exc_info = sys.exc_info()`` and the requisite clean-up
        for you.

        ``kwargs`` are passed through to ``.capture``.
        NT�raven.events.Exceptionr�)ro)r%r�r)r2r�rs   r)r�zClient.captureException&sS�� ��x�4�/�/��|�~�~�H��t�|�$�C�C�/7�C�;A�C�C�	Cr(c�$���|d��j�d�j���|j}d�|D��}d�|D��}d�|D��}�|vsC�j|vs:�|vs6t�fd�|D����st�fd�|D����rdSd	S)
Nrr.c3�DK�|]}t|t���|V��dSrT)r5�
basestring�r�rHs  r)r�z(Client.should_capture.<locals>.<genexpr>@s1����P�P�1�j��J�6O�6O�P�Q�P�P�P�P�P�Pr(c3�DK�|]}|�d���|V��dS)�*N)�endswithrss  r)r�z(Client.should_capture.<locals>.<genexpr>As1����O�O�Q�q�z�z�#���O�q�O�O�O�O�O�Or(c3�8K�|]}t|���|V��dSrTrrss  r)r�z(Client.should_capture.<locals>.<genexpr>Bs-����@�@�!�W�Q�Z�Z�@�A�@�@�@�@�@�@r(c3�8�K�|]}t�|��V��dSrT)�
issubclass)r�rH�exc_types  �r)r�z(Client.should_capture.<locals>.<genexpr>Gs-�����I�I�1�z�(�A�.�.�I�I�I�I�I�Ir(c3�R�K�|]!}��|dd���V��"dS)Nr1r�)r�rH�exc_names  �r)r�z(Client.should_capture.<locals>.<genexpr>Hs9�����P�P�q�x�*�*�1�S�b�S�6�2�2�P�P�P�P�P�Pr(FT)r9r8rqr)r2r��
exclusions�string_exclusions�wildcard_exclusions�class_exclusionsr|rzs      @@r)r*zClient.should_capture<s������A�;��&�1�1�1�8�3D�3D�E���+�
�P�P�
�P�P�P��O�O�*;�O�O�O��@�@�z�@�@�@���
�"�"��$�
�2�2��z�)�)��I�I�I�I�8H�I�I�I�I�I�*��P�P�P�P�<O�P�P�P�P�P�*��5��tr(c����d}tf}t|t��r|}n|�|}tj��fd���}||��}|r||��S|S)a�
        Wrap a function or code block in try/except and automatically call
        ``.captureException`` if it raises an exception, then the exception
        is reraised.

        By default, it will capture ``Exception``

        >>> @client.capture_exceptions
        >>> def foo():
        >>>     raise Exception()

        >>> with client.capture_exceptions():
        >>>    raise Exception()

        You can also specify exceptions to be caught specifically

        >>> @client.capture_exceptions((IOError, LookupError))
        >>> def bar():
        >>>     ...

        >>> with client.capture_exceptions((IOError, LookupError)):
        >>>    ...

        ``kwargs`` are passed through to ``.captureException``.
        Nc3�D�K�	dV�dS#|$r�jdi����wxYw)Nr')r�)�
exceptionsrr2s ��r)�make_decoratorz1Client.capture_exceptions.<locals>.make_decoratornsP�����
���������
�
�
�%��%�/�/��/�/�/��
���s��)rNr5r�
contextlib�contextmanager)r2�function_or_exceptionsrr?r�r��	decorators` `    r)�capture_exceptionszClient.capture_exceptionsLs�����4���\�
��,�l�;�;�	0�-�H�H�
#�
/�/�J�
�	"�	�	�	�	�	�
#�	"�	�#�N�:�.�.�	��	'��9�X�&�&�&��r(r'c�&�|j	d|||d�|��S)zi
        Creates an event for a SQL query.

        >>> client.captureQuery('SELECT * FROM foo')
        �raven.events.Query)�query�params�engine)r�rl)r2r�r�r�rs     r)�captureQueryzClient.captureQuery|s6���t�|� ��(-�f�V������	r(c�P�tjdt��|jdi|��S)Nz8captureExceptions is deprecated, used context() instead.r')r�r�r�rg�r2rs  r)�captureExceptionszClient.captureExceptions�s6���
�F��	 �	 �	 ��t�|�%�%�f�%�%�%r(c�4�|jjj|i|��dS)zp
        Records a breadcrumb with the current context.  They will be
        sent with the next event.
        N)rgr��record)r2�argsrs   r)�captureBreadcrumbzClient.captureBreadcrumb�s'��	(��� �'��8��8�8�8�8�8r(c�.�t|jdd��S)Nr-)r$rsrEs r)r-zClient.last_event_id�s���t�(�/�4�@�@�@r(c��||j_dSrT)rsr-)r2r�s  r)r-zClient.last_event_id�s��*/���'�'�'r()NFNTTNTN)NNrT)NNNNNNNN)NNNNNNN)r'N)9r8r9r:�__doc__rwrxryr[rrr�rFr�r}r�r�r��classmethodr�r�r�rr�r�r�r�r�rr�propertyrgr r$r&r(rr�rr3r:r8rPr,rTr]rSrGrmr�r*r�r�r�r��capture_breadcrumbr-�setterr'r(r)rrzs���������,�W�
�w�
'�
'�F���!�!�-?�@�@�@�I�DH�=A�9=�"�Z,�Z,�Z,�Z,�x���Q�Q�Q�Q�,
*�
*�
*����"�"�"��?�?��[�?�5�5�5����
�
�
�-�-�-�����"
�
�
�"6�6�6�1�1�1�59�FJ�)-�O�O�O�O�b6�6�6�
����X�����������	�	�	�DH�?C�P �P �P �P �d'�'�'����!�!�!�5�5�5�&+�+�+�$����<C�C�C�C�
�
�
�
�>���>�>�>�@�@�@�O�O�O�C�C�C�C�,��� .�.�.�.�`����&�&�&�9�9�9�+��
�A�A��X�A���0�0���0�0�0r(rc��eZdZdZd�ZdS)�DummyClientz"Sends messages into an empty void.c��dSrTr'r�s  r)r,zDummyClient.send�s���tr(N)r8r9r:r�r,r'r(r)r�r��s)������,�,�����r(r�)Gr��
__future__rrdrwr�r%rKr�r�r�inspectrr+r�typesr�	threadingr	r�r��contextlib2�threadrr��ImportError�_threadrW�
raven.confr
�raven.conf.remoter�raven.exceptionsrr�raven.utilsrrrr�raven.utils.compatrr�raven.utils.encodingr�raven.utils.serializerr�raven.utils.stacksrr�raven.utils.transactionr�raven.transport.registryrr�raven.events�__all__r�r
rZrr��strrrr*�dictr,�objectr<rr�r'r(r)�<module>r�s5����'�&�&�&�&�&���������	�	�	�	�
�
�
�
���������������������������������������������v��������$�$�$�$�6�4�4�4�4�4�4�4���6�6�6�5�5�5�5�5�5�5�5�6����
����������*�*�*�*�*�*�2�2�2�2�2�2�2�2�H�H�H�H�H�H�H�H�H�H�H�H�3�3�3�3�3�3�3�3�+�+�+�+�+�+�,�,�,�,�,�,�@�@�@�@�@�@�@�@�4�4�4�4�4�4�J�J�J�J�J�J�J�J����������
�
��}�
�
�	�	
����v����J�9�9�9�	�	�	�	�	�t�	�	�	�")�")�")�")�")�&�")�")�")�Jd0�d0�d0�d0�d0�V�d0�d0�d0�N�����&�����s�A�A-�,A-

Zerion Mini Shell 1.0