File: //usr/lib/python3.6/site-packages/glances/outputs/__pycache__/glances_stdout_apidoc.cpython-36.pyc
3
Eo�c� � @ s� d Z ddlmZ ddlZddlZddlmZ ddlmZ dZ dZ
dd d
�Zdd� Zd
d� Z
dd� Zdd� Zdd� Zdd� Zdd� Zdd� ZG dd� de�ZdS )z#Fields description interface class.� )�pformatN)�logger)� iteritemszhttp://localhost:61208/api/3a .. _api:
API (Restfull/JSON) documentation
=================================
The Glances Restfull/API server could be ran using the following command line:
.. code-block:: bash
# glances -w --disable-webui
Note: Change request URL api/3 by api/2 if you use Glances 2.x.
� c C sp t | t�rLt| �dkrLt | d t�rL|t| dd� �jdd| �jdd� S |t| �jdd| �jdd� S d S )N� r � �
�'�")�
isinstance�list�len�dictr �replace)�stat�indent� r �+/usr/lib/python3.6/glances_stdout_apidoc.py�indent_stat% s $(r c C sr d} t | � t dt| � � t d� t d� t d� t d� t d� t d� t djt�� t td�� t d� d S ) NzGET API status�-� z8This entry point should be used to check the API status.z@It will return nothing but a 200 return code if everythin is OK.zGet the Rest API status::z # curl -I {}/statuszHTTP/1.0 200 OK)�printr
�format�API_URLr )� sub_titler r r �print_api_status. s r c C sZ d}t |� t dt|� � t d� t d� t d� t djt�� t t| �� t d� d S )NzGET plugins listr r zGet the plugins list::z # curl {}/pluginslist)r r
r r r )r r r r r �print_plugins_list= s r c C sl dj | �}t|� tdt|� � td� td� td� tdj t| �� tttj|j� ��� td� d S )NzGET {}r r zGet plugin stats::z # curl {}/{})r r r
r r �json�loadsZ get_stats)�pluginr r r r r �print_plugin_statsI s
r c C s� |j rptd� td� xNt|j �D ]@\}}tdj||d jd�rP|d d d � n|d |d �� q"W td� ntjdj| �� d S )
NzFields descriptions:r z* **{}**: {} (unit is *{}*)�description�.r Zunitz4No fields_description variable defined for plugin {}���)Zfields_descriptionr r r �endswithr �error)r r Zfieldr! r r r �print_plugin_descriptionV s
r&