File: //usr/lib/python3.6/site-packages/glances/exports/__pycache__/glances_restful.cpython-36.pyc
3
Eo�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 sZ t t| �j||d� d| _d| _| jdddddgd�| _| jsFtd � i | _| j � | _
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__� �%/usr/lib/python3.6/glances_restful.pyr s zExport.__init__c C s6 | j s
dS dj| j| j| j| j�}tjdj|�� |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 Zurlr r r r - s
zExport.initc C sd || j � d krL| ji krLtjdjt| j�| j�� t| j| jdd� i | _tt ||��| j|<