Ejemplo n.º 1
0
 def _process_response(self):
     wrapped_error = None
     try:
         self.response.raise_for_status()
     except requests.exceptions.Timeout as err:
         wrapped_error = error.TimeoutError(err=err, exchange=self)
     except BaseException as err:
         if is_cached(self,'response') and (self.response.status_code < 200 or self.response.status_code >= 300):
             wrapped_error = error.ResponseError(err=err, exchange=self)
         else:
             wrapped_error = error.RequestError(err=err, exchange=self)
     if wrapped_error:
         if not self.process_error(wrapped_error, cached_value(self,'response')):
             return self._retry_or_fail(wrapped_error)
     return self.process_response(self.response)
Ejemplo n.º 2
0
    def triggered(self): return is_cached(self,'response')

    @cached_property