bug: fix not handling errors in send_graphql_query
This commit is contained in:
@@ -68,20 +68,23 @@ 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"
|
||||||
async with httpx.AsyncClient() as client:
|
try:
|
||||||
_auth = await client.post(
|
async with httpx.AsyncClient() as client:
|
||||||
url,
|
_auth = await client.post(
|
||||||
json={
|
url,
|
||||||
"query": 'mutation{auth{login(username:"'
|
json={
|
||||||
+ self.uname
|
"query": 'mutation{auth{login(username:"'
|
||||||
+ '", password:"'
|
+ self.uname
|
||||||
+ self.pwd
|
+ '", password:"'
|
||||||
+ '"){__typename}}}'
|
+ self.pwd
|
||||||
},
|
+ '"){__typename}}}'
|
||||||
)
|
},
|
||||||
d = await client.post(url, json={"query": query})
|
)
|
||||||
if d.status_code == 200:
|
d = await client.post(url, json={"query": query})
|
||||||
return d.json()
|
if d.status_code == 200:
|
||||||
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user