def _check_status(self, resp, expect=200): if resp.status_code == 400: r = json.loads(resp.text) raise InvalidSearch(r['message']) if resp.status_code == 401: raise AuthError('unauthorized') if resp.status_code == 404: raise NotFound('not found') if resp.status_code == 408: raise TimeoutError('timeout') if resp.status_code == 422: msg = json.loads(resp.text) raise SubmissionFailed(msg['message']) if resp.status_code == 429: raise CIFBusy('RateLimit exceeded') if resp.status_code in [500, 501, 502, 503, 504]: raise CIFBusy('system seems busy..') if resp.status_code != expect: msg = 'unknown: %s' % resp.content raise RuntimeError(msg)
def _check_status(self, resp, expect=200): if resp.status_code == 401: raise AuthError() if resp.status_code == 404: raise NotFound() if resp.status_code == 408: raise TimeoutError() if resp.status_code == 422: raise SubmissionFailed() if resp.status_code != expect: raise RuntimeError(resp.content)
def _fireball_timeout(self): logger.warn('timeout') self.loop.stop() raise TimeoutError('timeout')