moonraker: refactor "make_request"
The make_request() method is now awaitable and returns the result directly vs the previous behavior of returning a request that was awaited. There is no longer a need to check the result to see if it is an error, exceptions are raised if an error is detected. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
@@ -167,11 +167,8 @@ class FileManager:
|
||||
|
||||
async def _handle_operation_check(self, requested_path):
|
||||
# Get virtual_sdcard status
|
||||
request = self.server.make_request(
|
||||
result = await self.server.make_request(
|
||||
"objects/status", 'GET', {'print_stats': []})
|
||||
result = await request.wait()
|
||||
if isinstance(result, self.server.error):
|
||||
raise result
|
||||
pstats = result.get('print_stats', {})
|
||||
loaded_file = pstats.get('filename', "")
|
||||
state = pstats.get('state', "")
|
||||
|
Reference in New Issue
Block a user