From 4778aa957b70fb0a2f4b010b3bcc51a645e8d4f1 Mon Sep 17 00:00:00 2001 From: UpstreamData Date: Thu, 7 Oct 2021 15:55:27 -0600 Subject: [PATCH] Created get_commands for each api --- API/__init__.py | 3 +++ main.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/API/__init__.py b/API/__init__.py index b85c912e..96f7839a 100644 --- a/API/__init__.py +++ b/API/__init__.py @@ -22,6 +22,9 @@ class BaseMinerAPI: self.port = port self.ip = ipaddress.ip_address(ip) + def get_commands(self): + return [func for func in dir(self) if callable(getattr(self, func)) and not func.startswith("__") and func not in [func for func in dir(BaseMinerAPI) if callable(getattr(BaseMinerAPI, func))]] + async def multicommand(self, *commands: str) -> dict: command = "+".join(commands) return await self.send_command(command) diff --git a/main.py b/main.py index 72d32f57..2984859c 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,12 @@ from API.bosminer import BOSMinerAPI +from API.bmminer import BMMinerAPI from network import MinerNetwork import asyncio async def main(): + api = BMMinerAPI("192.168.1.1") + print(api.get_commands()) miner_network = MinerNetwork("192.168.1.1") await miner_network.scan_network_for_miners()