MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / check_response

Method check_response

scratchattach/utils/requests.py:234–242  ·  view source on GitHub ↗
(self, r: Response)

Source from the content-addressed store, hash-verified

232 error_handling: bool = True
233
234 def check_response(self, r: Response):
235 if r.status_code == 403 or r.status_code == 401:
236 raise exceptions.Unauthorized(f"Request content: {r.content!r}")
237 if r.status_code == 500:
238 raise exceptions.APIError("Internal Scratch server error")
239 if r.status_code == 429:
240 raise exceptions.Response429("You are being rate-limited (or blocked) by Scratch")
241 if r.json() == {"code":"BadRequest","message":""}:
242 raise exceptions.BadRequest("Make sure all provided arguments are valid")
243
244 @override
245 def get(self, *args, **kwargs):

Callers 6

getMethod · 0.95
postMethod · 0.95
deleteMethod · 0.95
putMethod · 0.95
sync_requestMethod · 0.45
async_requestMethod · 0.45

Calls 1

jsonMethod · 0.80

Tested by

no test coverage detected