관리-도구
편집 파일: send_message.cpython-311.opt-1.pyc
� IMg� � �� � d dl Z d dlZd dlZd dlZd dlmZmZ d dlm Z d dl mZ d dlm Z d dlmZ d dlmZmZ d dlmZ d d lmZmZmZ e e� � Z G d � dee� � Z G d� d e� � ZdS )� N)�ABC�abstractmethod)� getLogger)�Optional)�Core)�Message)�IndependentAgentIDAPI�IAIDTokenError)�ServerJSONEncoder)�API�APIError� APITokenErrorc �R � e Zd ZdZedefd�� � Zdeddfd�Zdede ddfd �Z dS ) �BaseSendMessageAPIz/api/v2/send-message/{method}�returnc � � K � d S �N� )�self�message_method�headers� post_datas �\/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/api/server/send_message.py� _send_requestz BaseSendMessageAPI._send_request s � � � ��� �resultNc �� � d|vr"t d� |� � � � �|d dk r5t d� |� d� � � � � � �d S )N�statusz unexpected server response: {!r}�okzserver error: {}�msg)r �format�get)r r s r �check_responsez!BaseSendMessageAPI.check_response sk � ��6�!�!��=�D�D�V�L�L�M�M�M��(��t�#�#��-�4�4�V�Z�Z��5F�5F�G�G�H�H�H� $�#r �methodr c � � K � t j � � � d {V ��}n$# t $ r}t d|� �� � �d }~ww xY wd|d�}| � |||� � � d {V ��}| � |� � d S )NzIAID token error occurred zapplication/json)zContent-TypezX-Auth)r � get_tokenr r r r# )r r$ r �token�er r s r � send_datazBaseSendMessageAPI.send_data"