| Server IP : 199.250.200.62 / Your IP : 216.73.216.15 Web Server : Apache System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : jasonp18 ( 1000) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/cwd/proc/self/root/proc/2/cwd/opt/imh-python/lib/python3.9/site-packages/cpapis/ |
Upload File : |
"""cpapi2 functions"""
from typing import Union
from ._base import CpAPIBase
class Cpapi2(CpAPIBase):
"""cpapi2 functions"""
__module__ = 'cpapis'
def __init__(self):
if self._can_exec('/usr/bin/cpapi2'):
super().__init__('/usr/bin/cpapi2')
else:
super().__init__('/usr/local/cpanel/bin/cpapi2')
def __call__(
self,
module: str,
user: Union[str, None] = None,
args: Union[dict, None] = None,
timeout: Union[float, None] = None,
):
"""Query cpapi2
Args:
module: the cpapi2 module to use in format x::y
user: ``--user`` arg to use
args: key-vals to send to cpapi2
timeout: timeout for the cpapi2 command in secs
"""
return self._exec(
module_args=module.split('::'),
user=user,
args=args,
timeout=timeout,
)