File: //opt/alt/python37/lib/python3.7/site-packages/clcommon/lib/__pycache__/whmapi_lib.cpython-37.pyc
B
A]#�W��� @ s� d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm Z ddl
mZ d ZG d
d� de�Z
G dd
� d
e
�ZG dd� de
�ZG dd� d�ZdS )z,
Everything that is related to whmapi calls
� )�print_function)�absolute_import)�divisionN)�FormattedException)�run_command)� urlencode)�
WhmApiRequest�WhmApiErrorc @ s e Zd ZdZdd� ZdS )r zW
An error that is raised in case of an error
in communication with whmapi.
c K s t �| ||d�� d S )N)�message�context)r �__init__)�selfr
r � r ��/builddir/build/BUILDROOT/alt-python27-cllib-3.4.1-1.el9.cloudlinux.x86_64/opt/alt/python37/lib/python3.7/site-packages/clcommon/lib/whmapi_lib.pyr s zWhmApiError.__init__N)�__name__�
__module__�__qualname__�__doc__r r r r r r s r c @ s e Zd ZdZdS )�WhmLicenseErrorz)A license-related error raised by whmapi.N)r r r r r r r r r % s r c @ s e Zd ZdZdS )�WhmNoPhpBinariesErrorz;
An error when there are no installed php binaries
N)r r r r r r r r r * s r c @ s\ e Zd ZdZdZdZdd� Zdd� Zedd � �Z e
d
d� �Ze
dd
� �Zdd� Z
dd� ZdS )r a
Wrapper over cpanel's whm command-line api tool
that allows us to easily build complex requests (filter, sorting, etc)
See details in the official cpanel docs (link below)
https://documentation.cpanel.net/display/DD/Guide+to+WHM+API+1
z/usr/sbin/whmapi1� c C s || _ i | _i | _ddg| _d S )Nz--output�json)�_command�_filters�_args�_extra_args)r
�commandr r r r = s zWhmApiRequest.__init__c C s� t |dd�\}}}|dkr&td|d��y>t�|�}d|krbd|d krb|d d d krbd|d d<