bug: fix auradine selection.

This commit is contained in:
UpstreamData
2024-01-24 16:23:25 -07:00
parent 41709e4706
commit 6a2a3e836d
2 changed files with 21 additions and 4 deletions

View File

@@ -485,6 +485,7 @@ class MinerFactory:
MinerTypes.EPIC: self.get_miner_model_epic,
MinerTypes.HIVEON: self.get_miner_model_hiveon,
MinerTypes.LUX_OS: self.get_miner_model_luxos,
MinerTypes.AURADINE: self.get_miner_model_auradine,
}
fn = miner_model_fns.get(miner_type)
@@ -964,10 +965,27 @@ class MinerFactory:
pass
async def get_miner_model_auradine(self, ip: str):
web_json_data = await self.send_web_command(ip, ":8080/ipreport")
try:
return web_json_data["IPReport"][0]["model"]
except (TypeError, LookupError):
async with httpx.AsyncClient(transport=settings.transport()) as client:
auth = await client.post(
f"http://{ip}:8080/token",
data={
"command": "token",
"username": "admin",
"password": settings.get(
"default_auradine_web_password", "admin"
),
},
timeout=settings.get("factory_get_timeout", 3),
)
token = auth.json()["Token"][0]["Token"]
web_json_data = await client.get(
f"http://{ip}:8080/ipreport",
headers={"Token": token},
timeout=settings.get("factory_get_timeout", 3),
)
return web_json_data.json()["IPReport"][0]["model"]
except (TypeError, LookupError, httpx.HTTPError):
pass

View File

@@ -11,7 +11,6 @@ readme = "README.md"
python = "^3.8"
httpx = "^0.26.0"
asyncssh = "^2.14.2"
grpc-requests = "^0.1.13"
passlib = "^1.7.4"
pyaml = "^23.12.0"
toml = "^0.10.2"