__init__.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:twopi-flask-utils 作者: TwoPiCode 项目源码 文件源码
def create_client(conf, app_version='__UNKNOWN__', ignore_common_http=True):
    """Creates a sentry client.

    :param app_version: (string): App version sent to sentry for making events more rich
    :param conf['SENTRY_DSN']: (string, required): DSN of sentry server
    :param conf['SENTRY_SITE']: (string): The site description of the deployment.
    :returns: An initialized ``raven.Client`` instance.
    """
    ignore_exceptions = []
    if ignore_common_http:
        ignore_exceptions = [
            'werkzeug.exceptions.BadRequest', # 400
            'werkzeug.exceptions.Unauthorized', # 401
            'werkzeug.exceptions.Forbidden', # 403
            'werkzeug.exceptions.NotFound', # 404
            'werkzeug.exceptions.MethodNotAllowed', # 405
            'marshmallow.exceptions.ValidationError', # Marshmallow Validation Error.
            'webargs.core.ValidationError', # Webargs Validation Error
        ]

    client = Client(
        conf['SENTRY_DSN'],
        site=conf.get('SENTRY_SITE'),
        release=app_version,
        ignore_exceptions=ignore_exceptions
    )
    return client
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号