1234567891011121314151617181920212223242526 |
- # api_clients.py
- from api.alist import AlistAPI
- from api.aria2 import Aria2API
- from api.nas_tools import NasToolsClient
- class APIManager:
- def __init__(self, config):
- self.config = config
- self.alist_api = AlistAPI(
- self.config.get_value('REMOTE_ALIST', 'API_URL'),
- self.config.get_value('REMOTE_ALIST', 'USERNAME'),
- self.config.get_value('REMOTE_ALIST', 'PASSWORD')
- )
- self.aria2_api = Aria2API(
- self.config.get_value('ARIA2', 'RPC_URL'),
- self.config.get_value('ARIA2', 'RPC_SECRET')
- )
- self.nas_tools_api = NasToolsClient(
- self.config.get_value('NSTOOLS', 'URL'),
- self.config.get_value('NSTOOLS', 'API_KEY')
- )
- def login_apis(self):
- self.nas_tools_api.login("admin","password") # Assuming the login method exists
- self.alist_api.login( self.config.get_value('REMOTE_ALIST', 'USERNAME'), self.config.get_value('REMOTE_ALIST', 'PASSWORD')) # Assuming the login method exists
|