����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.28 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/apiclient/ |
Upload File : |
import logging
from xray import gettext as _
logger = logging.getLogger('api_client.init')
def get_client(interface: str = 'api_task') -> 'Client object':
"""
Get a client according to given interface:
'api' --> MongoDB APIClient
'api_req' --> ClickHouse APIClient
'base' --> basic APIClient
'dbm' --> DBMClient
:param interface: 'api'|'api_req'|'base'|'dbm'
:return: a Client object
"""
if interface == 'api_task':
logger.info('Initializing MongoDB API client')
from .api_client import APIClient
return APIClient
elif interface == 'api_req':
logger.info('Initializing ClickHouse API client')
from .api_client import SendClient
return SendClient
elif interface == 'dbm':
logger.info('Initializing DBM API client')
from .api_client import DBMClient
return DBMClient
elif interface == 'auto_tasks':
logger.info('Initializing MongoDB API client for auto tasks')
from .api_client import TasksClient
return TasksClient
elif interface == 'lists':
logger.info('Initializing MongoDB API client for UI')
from .api_client import UIAPIClient
return UIAPIClient
elif interface == 'adviser':
logger.info('Initializing Smart Advice API client')
from .api_client import SmartAdviceAPIClient
return SmartAdviceAPIClient
elif interface == 'awp_provision':
logger.info('Initializing AWP Provision API client')
from .api_client import AWPProvisionAPIClient
return AWPProvisionAPIClient
else:
logger.error('Unknown client to initialize',
extra={'requested_client': interface})
raise RuntimeError(_("Do not know client of '%s' interface") % str(interface))