/usr/share/cagefs-skeleton/lib/python3.9/site-packages/glances/exports/__pycache__
a ���cv � @ sH d Z ddlmZ ddlmZ ddlmZ ddlmZ G dd� de�Z dS ) zRESTful interface class.� )�listkeys)�logger)� GlancesExport)�postc s2 e Zd ZdZd � fdd� Zdd� Zdd� Z� ZS ) �ExportznThis class manages the RESTful export module. Be aware that stats will be exported in one big POST requestNc sV t t| �j||d� d| _d| _| jdg d�d�| _| jsBtd� i | _| � � | _ dS )zInit the RESTful export IF.)�config�argsNZrestful)�host�port�protocol�path)ZmandatorieszMissing RESTFUL config)�superr �__init__r r Z load_conf� export_enable�exit�buffer�init�client)�selfr r �� __class__� �C/usr/lib/python3.9/site-packages/glances/exports/glances_restful.pyr s zExport.__init__c C s6 | j s dS d�| j| j| j| j�}t�d�|�� |S )z*Init the connection to the RESTful server.Nz{}://{}:{}{}z1Stats will be exported to the RESTful endpoint {})r �formatr r r r r �info)r �urlr r r r - s zExport.initc C sd || � � d krL| ji krLt�d�t| j�| j�� t| j| jdd� i | _tt ||��| j|<