|
Server : LiteSpeed System : Linux srv104790275 5.15.0-161-generic #171-Ubuntu SMP Sat Oct 11 08:17:01 UTC 2025 x86_64 User : dewac4139 ( 1077) PHP Version : 8.0.30 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/local/CyberPanel/lib/python3.10/site-packages/CloudFlare/ |
Upload File : |
""" errors for Cloudflare API"""
class CloudFlareError(Exception):
""" errors for Cloudflare API"""
class CodeMessage(object):
""" a small class to save away an interger and string (the code and the message)"""
def __init__(self, code, message):
self.code = code
self.message = message
def __int__(self):
return self.code
def __str__(self):
return self.message
def __init__(self, code, message, error_chain=None):
""" errors for Cloudflare API"""
self.evalue = self.CodeMessage(int(code), str(message))
self.error_chain = None
if error_chain is not None:
self.error_chain = []
for evalue in error_chain:
self.error_chain.append(
self.CodeMessage(int(evalue['code']), str(evalue['message'])))
# self.error_chain.append({'code': self.code, 'message': str(self.message)})
def __int__(self):
""" integer value for Cloudflare API errors"""
return int(self.evalue)
def __str__(self):
""" string value for Cloudflare API errors"""
return str(self.evalue)
def __len__(self):
""" Cloudflare API errors can contain a chain of errors"""
if self.error_chain is None:
return 0
return len(self.error_chain)
def __getitem__(self, ii):
""" Cloudflare API errors can contain a chain of errors"""
return self.error_chain[ii]
def __iter__(self):
""" Cloudflare API errors can contain a chain of errors"""
if self.error_chain is None:
return
for evalue in self.error_chain:
yield evalue
def next(self):
""" Cloudflare API errors can contain a chain of errors"""
if self.error_chain is None:
raise StopIteration
class CloudFlareAPIError(CloudFlareError):
""" errors for Cloudflare API"""
class CloudFlareInternalError(CloudFlareError):
""" errors for Cloudflare API"""