本文整理匯總了Python中werkzeug.exceptions.HTTPException.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python HTTPException.__init__方法的具體用法?Python HTTPException.__init__怎麽用?Python HTTPException.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類werkzeug.exceptions.HTTPException
的用法示例。
在下文中一共展示了HTTPException.__init__方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, data, description=None):
"""
param: data: A dictionary containing the field errors that occured
param: description: Optional description to send through
"""
HTTPException.__init__(self)
self.data = data
示例2: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, description, locator="", code=400):
self.code = code
self.description = description
self.locator = locator
logging.exception(description)
HTTPException.__init__(self)
示例3: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, description, locator="", code=400):
self.code = code
self.description = description
self.locator = locator
msg = 'Exception: code: %s, locator: %s, description: %s' % (self.code, self.description, self.locator)
LOGGER.exception(msg)
HTTPException.__init__(self)
示例4: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(message=None, data=None, code=400, **kwargs):
data = data or kwargs
if instanceof(message, str):
data, message = message, None
if message:
data["message"] = message
response = jsonify(status="fail", data=data)
response.status_code = status_code
HTTPException.__init__(self, message, response)
self.code = code
示例5: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, message=''):
# HTTPException has its own custom __init__ method, but we want the
# usual "First argument is the message" behavior.
HTTPException.__init__(self)
self.message = message
示例6: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, code, description):
HTTPException.__init__(self)
self.code = code
self.description = description
示例7: init
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def init(self, description=None, response=None, traceback=None):
self.traceback = traceback
HTTPException.__init__(self, description, response)
示例8: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, valid_methods=None, description=None):
"""Takes an optional list of valid http methods
starting with werkzeug 0.3 the list will be mandatory."""
HTTPException.__init__(self, description)
self.valid_methods = valid_methods
示例9: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, location):
HTTPException.__init__(self)
self.location = location
示例10: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, message="Internal Error", response=None):
if WERKZEUG:
HTTPException.__init__(self, message, response)
else:
self.description = message
self.response = response
示例11: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__ (self, detail='not Found', status=404):
HTTPException.__init__ (self)
self.detail = detail
self.status = status
示例12: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, message, code=None):
HTTPException.__init__(self, message)
if code is not None:
self.code = code
示例13: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, _server_id, _database_name, _conn_id):
self.sid = _server_id
self.db = _database_name
self.conn_id = _conn_id
HTTPException.__init__(self)
示例14: __init__
# 需要導入模塊: from werkzeug.exceptions import HTTPException [as 別名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 別名]
def __init__(self, article_name, original_link, description=None):
HTTPException.__init__(self, description)
self.article_name = article_name
self.original_link = original_link