JFIF$        dd7 

Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/sentry_sdk/__pycache__/client.cpython-311.pyc

�

� �������ddlZddlZddlZddlmZddlmZddlZddlmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZddlmZddlmZddlmZmZmZdd	lmZdd
lmZddl m!Z!ddl"m#Z#dd
l$m%Z%e%r2ddl&m'Z'ddl&m(Z(ddl&m)Z)ddl&m*Z*ddl&m+Z+ddl,m-Z-ddl$m.Z.m/Z/ddl m0Z0ed��Z1d�Z2Gd�de3��Z4dd
l$m%Z%e%r(Gd�dee)e5e'f��Z6Gd�dee4��Z7dSd���Z6d���Z7dS) �N)�datetime)�islice)�string_types�	text_type�	iteritems)	�capture_internal_exceptions�current_stacktrace�disable_capture_event�format_timestamp�
get_type_name�get_default_release�get_default_environment�
handle_in_app�logger)�	serialize)�make_transport)�DEFAULT_OPTIONS�SDK_INFO�ClientConstructor)�setup_integrations)�
ContextVar)�SessionFlusher)�Envelope)�MYPY)�Any)�Callable)�Dict)�List)�Optional)�Scope)�Event�Hint)�Session�client_init_debugc��|rCt|dtttf��s|d�|d}|dd�}nd}t	t
��}t	|i|��}|�|�d���||d<t|��D] \}}||vrtd|�����|||<�!|d�"tj
�d��|d<|d�t��|d<|d�t|d��|d<|d�+ttd	��rtj��|d<|S)
Nr��dsnzUnknown option �
SENTRY_DSN�release�environment�server_name�gethostname)�
isinstancer�bytes�str�dictr�getr�	TypeError�os�environr
r�hasattr�socketr,)�args�kwargsr'�rv�options�key�values       �q/builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib/python3.11/site-packages/sentry_sdk/client.py�_get_optionsr>-sZ�����D��G�i���%<�=�=���a����1�g���A�B�B�x�����	
�o�	�	�B��D�#�F�#�#�G�
��7�;�;�u�-�-�5�������(�(���
��U��b�=�=��)�3�3�8�9�9�9���3���	�%�y���J�N�N�<�0�0��5�	�	�)�}��+�-�-��9�
�	�-�� �3�B�y�M�B�B��=��	�-�� �W�V�]�%C�%C� �"�.�0�0��=��
�I�c��eZdZdZd�Zd�Zd�Zd�Zed���Z	d�Z
d�Z	dd
�Zd�Z
		dd�Zd
�Z		dd�Z		dd�Zd�Zd�Zd	S)�_Clientz�The client is internally responsible for capturing the events and
    forwarding them to sentry through the configured transport.  It takes
    the client options as keyword arguments and optionally the DSN as first
    argument.
    c�P�t|i|��|_|���dS�N)�get_optionsr:�
_init_impl)�selfr7r8s   r=�__init__z_Client.__init__Us,��"�D�3�F�3�3����������r?c��d|jiS�Nr:�r:�rFs r=�__getstate__z_Client.__getstate__Zs���4�<�(�(r?c�H�|d|_|���dSrI)r:rE)rF�states  r=�__setstate__z_Client.__setstate__^s$���Y�'����������r?c�6��t�d��}�fd�}	t��jd��t	�j���_t
|����_d}�jd|vr"td�	|�����t�jd�jd	�jd
����_t�|��dS#t�|��wxYw)NFc�����j}|r|sdSt|��}	t��}t|d��D]}|�|���|jsdS|�|���U)NT�d)�	transport�iterrr�add_session�items�capture_envelope)�sessionsrS�
sessions_iter�envelope�sessionrFs     �r=�_send_sessionsz*_Client._init_impl.<locals>._send_sessionsgs������I��
�H�
��� ��N�N�M�
5�#�:�:��%�m�S�9�9�2�2�G��(�(��1�1�1�1��~���E��*�*�8�4�4�4�

5r?�debug)�
flush_func)�always�never�small�medium�request_bodiesz3Invalid value for request_bodies. Must be one of {}�integrations�default_integrations�auto_enabling_integrations)�
with_defaults�with_auto_enabling_integrations)�_client_init_debugr1�setr:rrSr�session_flusher�
ValueError�formatrrd)rF�	old_debugr\rcs`   r=rEz_Client._init_implcs%���&�*�*�5�1�1�	�	5�	5�	5�	5�	5�	.��"�"�4�<��#8�9�9�9�+�D�L�9�9�D�N�#1�^�#L�#L�#L�D� �C�N��|�,�-�^�C�C� �I�P�P�&������!3���^�,�"�l�+A�B�04��0�1�!�!�!�D��
�"�"�9�-�-�-�-�-���"�"�9�-�-�-�-���s�B>C<�<Dc��|jdS)z%Returns the configured DSN as string.r'rJrKs r=r'z_Client.dsn�s���|�E�"�"r?c��|�d���tj��|d<|�|�||��}|�dS|}|jdrVd|vrRd|vrNd|vrJt��5dt
|jd��dd	d
�gi|d<ddd��n#1swxYwYdD]S}|�|���<|j|�/t|j|�����||<�T|�d���Btt��}t|j�
����|d
<||d<|�d���d|d<t||jd|jd��}|�/t||jd�d�����}|jd}|�h|�d��dkrOd}t��5|||pi��}ddd��n#1swxYwY|�t!jd|��|}|S)N�	timestamp�attach_stacktrace�	exception�
stacktrace�threads�values�with_localsFT)rt�crashed�current)r)r*r+�dist�sdkrd�platform�python�in_app_exclude�in_app_include�_experiments�smart_transaction_trimming)r��before_send�type�transactionzbefore send dropped event (%s))r1r�utcnow�apply_to_eventr:rr	r�stripr0r�sortedrd�keysrrr�info)	rF�event�hint�scope�event_r;�sdk_infor��	new_events	         r=�_prepare_eventz_Client._prepare_event�s���9�9�[�!�!�)�!)��!2�!2�E�+�����)�)�%��6�6�F��~��t��E�
�L�,�-�	��5�(�(��E�)�)���&�&�,�.�.�
�
��*<� $��]� ;�+�+�(-�'+����
$��i� �
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�C�	B�	B�C��y�y��~�~�%�$�,�s�*;�*G�&�t�|�C�'8�9�9�?�?�A�A��c�
���9�9�U���#��H�~�~�H�'-�d�.?�.D�.D�.F�.F�'G�'G�H�^�$�#�E�%�L��9�9�Z� � �(� (�E�*����4�<� 0�1�4�<�@P�3Q�
�
������+/�<��+G�+K�+K�0�,�,����E��l�=�1���"�u�y�y��'8�'8�M�'I�'I��I�,�.�.�
;�
;�'�K��t�z�r�:�:�	�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;�
;����
;�
;�
;�
;�� ���<�e�D�D�D��E��s$�1%B"�"B&�)B&�H�H#�&H#c�"�|�d��}|�dSt|d��}|dj�d|��}|jdD]@}t	|t
��r||ks||krdS�'t
|d|��rdS�AdS)N�exc_infoFr�.�
ignore_errorsT)r1r�
__module__r:r-r�
issubclass)rFr�r�r��	type_name�	full_name�errclss       r=�_is_ignored_errorz_Client._is_ignored_error�s����8�8�J�'�'�����5�!�(�1�+�.�.�	�'��{�5�5�5�y�y�A�	��l�?�3�	 �	 �F��&�,�/�/�
 ��Y�&�&�&�I�*=�*=��4�4�+>��h�q�k�6�2�2� ��4�4� ��ur?Nc���|�d��dkrdS|�	|jsdS|jddkr$tj��|jdkrdS|�||��rdSdS)Nr�r�TF�sample_rateg�?)r1�_should_capturer:�randomr�)rFr�r�r�s    r=r�z_Client._should_capture�s����9�9�V���
�-�-��4���U�%:���5�
�L��'�#�-�-��
���4�<�
�#>�>�>��5��!�!�%��.�.�	��5��tr?c��d}d}d}|�d��pi�d��}|r9d}|D]4}|�d��}|r|�d��durd}n�5|�d��}	|j�]|�d��pi�d	��}
t|
pi��D]!\}}|���d
kr|}n�"|�|rdnd|	||j|p|z���dS)
NFrsrvT�	mechanism�handled�user�request�headersz
user-agentrx)�statusr��
user_agent�errors)r1r�r�lower�updater�)
rFr[r�rx�erroredr��
exceptions�errorr�r�r��k�vs
             r=�_update_session_from_eventz"_Client._update_session_from_eventsT�������
��i�i��,�,�2��7�7��A�A�
��	��G�#�
�
��!�I�I�k�2�2�	������y�!9�!9�U�!B�!B�"�G��E���y�y�� � ����%��y�y��+�+�1�r�6�6�y�A�A�G�#�G�M�r�2�2�
�
���A��7�7�9�9��,�,�!"�J��E�-�	��� '�1�9�9�T��!��>�W�%7��8�		�	
�	
�	
�	
�	
r?c�v�tjd��rdS|j�dS|�i}|�d��}t|pd��}|�t	j��jx|d<}|�|||��sdS|�|||��}|�dS|r|j	nd}|r|�
||��|�d��}|�d��dk}|s|r�t|dttj����d��	��}	|r|	�|��n|	�|��|pdD])}
|	�|
������*|j�|	��n|j�|��|S)
a�Captures an event.

        :param event: A ready-made event that can be directly sent to Sentry.

        :param hint: Contains metadata about the event that can be read from `before_send`, such as the original exception object or a HTTP request object.

        :returns: An event ID. May be `None` if there is no DSN set or of if the SDK decided to discard the event for other reasons. In such situations setting `debug=True` on `init()` may help.
        FN�event_id��attachmentsr�r�)r��sent_at)r�)r
r1rSr0�uuid�uuid4�hexr�r��_sessionr�rrrr��add_transaction�	add_event�add_item�to_envelope_itemrW�
capture_event)rFr�r�r�r��	event_optr[r��is_transactionrZ�
attachments           r=r�z_Client.capture_event,s���!�$�U�+�+�	��4��>�!��4��<��D��9�9�Z�(�(���D�J�B������+/�:�<�<�+;�;�E�*����#�#�E�4��7�7�	��4��'�'��t�U�;�;�	����4�%*�3�%�.�.�t���	<��+�+�G�U�;�;�;��h�h�}�-�-��"���v�.�.�-�?���	4�[�	4� � )�*� 5�/���0A�0A�B�B������H��
.��(�(��3�3�3�3��"�"�9�-�-�-�)�/�R�
A�
A�
��!�!�*�"=�"=�"?�"?�@�@�@�@��N�+�+�H�5�5�5�5�
�N�(�(��3�3�3��r?c�t�|jstjd��dS|j�|��dS)Nz3Discarded session update because of missing release)r)rr�rkrU)rFr[s  r=�capture_sessionz_Client.capture_sessionnsB����	6��K�M�N�N�N�N�N�� �,�,�W�5�5�5�5�5r?c��|j�R|�||���|j���|j���d|_dSdS)z�
        Close the client and shut down the transport. Arguments have the same
        semantics as :py:meth:`Client.flush`.
        N��timeout�callback)rS�flushrk�kill�rFr�r�s   r=�closez
_Client.closews^���>�%��J�J�w��J�:�:�:�� �%�%�'�'�'��N���!�!�!�!�D�N�N�N�	&�%r?c��|j�F|�
|jd}|j���|j�||���dSdS)a#
        Wait for the current events to be sent.

        :param timeout: Wait for at most `timeout` seconds. If no `timeout` is provided, the `shutdown_timeout` option value is used.

        :param callback: Is invoked with the number of pending events and the configured timeout.
        N�shutdown_timeoutr�)rSr:rkr�r�s   r=r�z
_Client.flush�s\���>�%����,�'9�:��� �&�&�(�(�(��N� � ��8� �D�D�D�D�D�	&�%r?c��|SrCr�rKs r=�	__enter__z_Client.__enter__�s���r?c�.�|���dSrC)r�)rF�exc_type�	exc_value�tbs    r=�__exit__z_Client.__exit__�s���
�
�����r?rC)NN)�__name__r��__qualname__�__doc__rGrLrOrE�propertyr'r�r�r�r�r�r�r�r�r�r�r�r?r=rArANsK�����������
)�)�)����
'.�'.�'.�R�#�#��X�#�
F�F�F�P���2�	����2"
�"
�"
�N��	@�@�@�@�D6�6�6���"�"�"�"�$��E�E�E�E�&�������r?rAc��eZdZdS)rDN�r�r�r�r�r?r=rDrD���������r?rDc��eZdZdS)�ClientNr�r�r?r=r�r��r�r?r�c��tSrC)r>r�r?r=�<lambda>r��s��<�r?c��tSrC)rAr�r?r=r�r��s��g�r?)8r3r�r�r�	itertoolsrr6�sentry_sdk._compatrrr�sentry_sdk.utilsrr	r
rrr
rrr�sentry_sdk.serializerr�sentry_sdk.transportr�sentry_sdk.constsrrr�sentry_sdk.integrationsrr�sentry_sdk.sessionsr�sentry_sdk.enveloper�sentry_sdk._typesr�typingrrrrr�sentry_sdk.scoper r!r"r#rir>�objectrAr/rDr�r�r?r=�<module>r�s��	�	�	�	�����
�
�
�
�������������
�
�
�
�A�A�A�A�A�A�A�A�A�A�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�,�+�+�+�+�+�/�/�/�/�/�/�J�J�J�J�J�J�J�J�J�J�6�6�6�6�6�6�'�'�'�'�'�'�.�.�.�.�.�.�(�(�(�(�(�(�"�"�"�"�"�"��	,�������������������������������&�&�&�&�&�&�-�-�-�-�-�-�-�-�+�+�+�+�+�+� �Z� 3�4�4�����BR�R�R�R�R�f�R�R�R�j
#�"�"�"�"�"��!�
�
�
�
�
�'��c�3�h��
�
�
�
�
�
�
�
�"�G�
�
�
�
�
�(�'�'�*�*�K��o�o�
 �
 �F�F�Fr?
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`w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