bug: clarify uppercasing data from __get_model_from_graphql()

This commit is contained in:
Upstream Data
2022-11-13 19:27:32 -07:00
parent 4eac601153
commit 25094084cf

View File

@@ -337,7 +337,7 @@ class MinerFactory(metaclass=Singleton):
break break
except asyncio.TimeoutError: except asyncio.TimeoutError:
logging.warning(f"{ip}: Get Miner Timed Out") logging.warning(f"{ip}: Get Miner Timed Out")
print(ip, model, api, ver)
miner = self._select_miner_from_classes(ip, model, api, ver) miner = self._select_miner_from_classes(ip, model, api, ver)
# save the miner to the cache at its IP if its not unknown # save the miner to the cache at its IP if its not unknown
@@ -345,6 +345,7 @@ class MinerFactory(metaclass=Singleton):
self.miners[ip] = miner self.miners[ip] = miner
# return the miner # return the miner
print(miner)
return miner return miner
@staticmethod @staticmethod
@@ -437,6 +438,7 @@ class MinerFactory(metaclass=Singleton):
model = await self.__get_model_from_graphql(ip) model = await self.__get_model_from_graphql(ip)
if model: if model:
api = "BOSMiner+" api = "BOSMiner+"
print(model, api, ver)
return model, api, ver return model, api, ver
for _devdetails_key in ["Model", "Driver"]: for _devdetails_key in ["Model", "Driver"]:
@@ -604,8 +606,10 @@ class MinerFactory(metaclass=Singleton):
url = f"http://{ip}/graphql" url = f"http://{ip}/graphql"
async with httpx.AsyncClient() as client: async with httpx.AsyncClient() as client:
d = await client.post(url, json={"query": "{bosminer {info{modelName}}}"}) d = await client.post(url, json={"query": "{bosminer {info{modelName}}}"})
print(d)
if d.status_code == 200: if d.status_code == 200:
model = d.json()["data"]["bosminer"]["info"]["modelName"].upper() model = (d.json()["data"]["bosminer"]["info"]["modelName"]).upper()
print(model)
return model return model
@staticmethod @staticmethod