bug: fix not handling errors in send_graphql_query

This commit is contained in:
Upstream Data
2022-11-13 19:16:48 -07:00
parent cfa550f8c0
commit f0d8d66b9b

View File

@@ -68,6 +68,7 @@ class BOSMiner(BaseMiner):
async def send_graphql_query(self, query) -> Union[dict, None]: async def send_graphql_query(self, query) -> Union[dict, None]:
url = f"http://{self.ip}/graphql" url = f"http://{self.ip}/graphql"
try:
async with httpx.AsyncClient() as client: async with httpx.AsyncClient() as client:
_auth = await client.post( _auth = await client.post(
url, url,
@@ -82,6 +83,8 @@ class BOSMiner(BaseMiner):
d = await client.post(url, json={"query": query}) d = await client.post(url, json={"query": query})
if d.status_code == 200: if d.status_code == 200:
return d.json() return d.json()
except httpx.ReadError:
return None
return None return None
async def fault_light_on(self) -> bool: async def fault_light_on(self) -> bool: