def fetch_url(self, fetch_url, **kwargs): try: response = yield fetch_and_trace_response(fetch_url, **kwargs) except HTTPError as e: yield self.handle_fetch_exception(e, fetch_url) raise gen.Return() raise gen.Return(response)
def fetch_url(self, fetch_url, skip_except_handle=False, **kwargs): try: response = yield fetch_and_trace_response(fetch_url, **kwargs) except HTTPError as e: if not skip_except_handle: yield self.handle_fetch_exception(e, fetch_url) raise gen.Return() raise gen.Return(response)
def fetch_and_redirect(self, fetch_url, **kwargs): """处了fetch_url,其他的必须使用kwargs传递""" try: response = yield fetch_and_trace_response(fetch_url, **kwargs) except HTTPError as e: yield self.handle_fetch_exception(e, fetch_url) raise gen.Return() yield self.response_redirect( response.code, body=response.body, content_type=response.headers.get("Content-Type", None)) raise gen.Return()
def fetch_and_redirect(self, fetch_url, **kwargs): """处了fetch_url,其他的必须使用kwargs传递""" try: response = yield fetch_and_trace_response(fetch_url, **kwargs) except HTTPError as e: yield self.handle_fetch_exception(e, fetch_url) raise gen.Return() yield self.response_redirect(response.code, body=response.body, content_type=response.headers.get( "Content-Type", None)) raise gen.Return()