diff --git a/dank_mids/requests.py b/dank_mids/requests.py index 037c2a3c..801d7091 100644 --- a/dank_mids/requests.py +++ b/dank_mids/requests.py @@ -184,7 +184,7 @@ async def get_response(self) -> RPCResponse: if isinstance(self.response, RawResponse): response = self.response.decode(partial=True).to_dict(self.method) if 'error' in response: - if response['error']['message'] in ['invalid request', 'Parse error']: + if response['error']['message'].lower() in ['invalid request', 'parse error']: if self.controller._time_of_request_type_change == 0: self.controller.request_type = Request self.controller._time_of_request_type_change = time.time() @@ -228,7 +228,7 @@ async def spoof_response(self, data: Union[RawResponse, bytes, Exception]) -> No if isinstance(data, RawResponse): self._response = data elif isinstance(data, BadResponse): - if data.response.error.message in ['invalid request', 'Parse error']: + if data.response.error.message.lower() in ['invalid request', 'parse error']: if self.controller._time_of_request_type_change == 0: self.controller.request_type = Request self.controller._time_of_request_type_change = time.time() @@ -409,7 +409,7 @@ def should_retry(self, e: Exception) -> bool: logger.debug('Dank too loud. Bisecting batch and retrying.') elif isinstance(e, BadResponse) and ('invalid request' in f"{e}" or 'Parse error' in f"{e}"): pass - elif "error processing call Revert" not in f"{e}" and "429" not in f"{e}": + elif "error processing call Revert" not in f"{e}" and "429" not in f"{e}" and "resource not found" not in f"{e}": logger.warning(f"unexpected {e.__class__.__name__}: {e}") return len(self) > 1 @@ -709,7 +709,7 @@ async def post(self) -> List[RawResponse]: if isinstance(response, list): return response # Oops, we failed. - if response.error.message in ['invalid request', 'Parse error']: + if response.error.message.lower() in ['invalid request', 'parse error']: # NOT SURE IF THIS ACTUALLY RUNS, CAN WE RECEIVE THIS TYPE RESPONSE FOR A JSON BATCH? if self.controller._time_of_request_type_change == 0: self.controller.request_type = Request