本文整理匯總了Python中tornado.httpclient.HTTPError類的典型用法代碼示例。如果您正苦於以下問題:Python HTTPError類的具體用法?Python HTTPError怎麽用?Python HTTPError使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了HTTPError類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: handle_exception
def handle_exception(self, typ, error, tb):
if isinstance(error, _RequestTimeout):
if self._stream_ended:
self.finish()
return True
else:
error = HTTPError(599, "Timeout")
self._remove_timeout()
self._unregister_unfinished_streams()
if hasattr(self, "stream_id"):
self.context.remove_stream_delegate(self.stream_id)
# FIXME: our nginx server will simply reset stream,
# without increase the window size which consumed by
# queued data frame which was belongs to the stream we're resetting
# self.context.reset_stream(self.stream_id, flush=True)
self.context.reset_stream_ids.append(self.stream_id)
error.__traceback__ = tb
response = HTTP2Response(self.request, 599, error=error, request_time=self.io_loop.time() - self.start_time)
self._run_callback(response)
return True
示例2: __init__
def __init__(self, errno, message):
HTTPError.__init__(self, 599, message)
self.errno = errno
示例3: __init__
def __init__(self, errno: int, message: str) -> None:
HTTPError.__init__(self, 599, message)
self.errno = errno
示例4: __init__
def __init__(self, status_code, user_message, log_message=None, *args):
HTTPError.__init__(self, status_code, log_message, *args)
self.user_message = user_message