| 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/2/cwd/proc/self/root/opt/imh-python/lib/python3.9/site-packages/cpapis/ |
Upload File : |
"""Errors (and warnings) for cpapis"""
class CpAPIError(Exception):
"""Parent class for all errors running uapi/whmapi/cpapi"""
__module__ = 'cpapis'
class CpAPIErrorMsg(CpAPIError):
"""Raised when an API executes and returns valid JSON, but the operation
fails and reports a specific error message. This differs per API function"""
__module__ = 'cpapis'
def __init__(self, *, msg: str, data: dict):
super().__init__(str(msg))
self.data = data
class CpAPIExecFail(CpAPIError):
"""Raised when an API call fails to run at all by exiting non-zero, timing
out or returning invalid JSON
Attributes:
cmd: The list or str args passed to run().
returncode: The exit code of the process, negative for signals.
stdout: The standard output
stderr: The standard error
"""
__module__ = 'cpapis'
def __init__(
self,
*,
msg: str,
cmd: list[str],
stdout: str,
stderr: str,
returncode: int,
):
super().__init__(msg)
self.cmd = cmd
self.stdout = stdout
self.stderr = stderr
self.returncode = returncode
class CpAPIDeprecation(DeprecationWarning):
"""Subclass of DeprecationWarning for cpapis"""
__module__ = 'cpapis'