PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/sentry_sdk/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/sentry_sdk/__pycache__/client.cpython-311.pyc

�

��h 8���ddlZddlZddlZddlmZddlmZddlZddlmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZddlmZddlmZddlmZmZmZdd	lmZdd
lmZddl m!Z!ddl"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       �H/opt/imunify360/venv/lib64/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
�Zd�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
rrr
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?

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic