Skip to content

Commit

Permalink
Update spoolman.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeanon committed Jan 17, 2024
1 parent 5ffca82 commit c84d699
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions moonraker/components/spoolman.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ async def track_filament_usage(self):
},
)
if response.has_error():
logging.info(response._error)
if not self.has_printed_error_since_last_down:
response.raise_for_status()
self.has_printed_error_since_last_down = True
Expand All @@ -165,7 +166,7 @@ async def _handle_spool_id_request(self, web_request: WebRequest):
# For GET requests we will simply return the spool_id
return {"spool_id": self.spool_id}

async def _proxy_spoolman_request(self, web_request: WebRequest, retry=False):
async def _proxy_spoolman_request(self, web_request: WebRequest):
method = web_request.get_str("request_method")
path = web_request.get_str("path")
query = web_request.get_str("query", None)
Expand Down Expand Up @@ -196,14 +197,7 @@ async def _proxy_spoolman_request(self, web_request: WebRequest, retry=False):
url=full_url,
body=body,
)

if (response._code == 404
and self.spool_id is not None
and dict(response.json()).get("message")
== ("No spool with ID %d found." % self.spool_id)):
await self.set_active_spool(None)
else:
response.raise_for_status()
response.raise_for_status()

return response.json()

Expand Down

0 comments on commit c84d699

Please sign in to comment.