本文整理汇总了Python中sentry.models.ProjectKey.from_dsn方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectKey.from_dsn方法的具体用法?Python ProjectKey.from_dsn怎么用?Python ProjectKey.from_dsn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentry.models.ProjectKey
的用法示例。
在下文中一共展示了ProjectKey.from_dsn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_project_key
# 需要导入模块: from sentry.models import ProjectKey [as 别名]
# 或者: from sentry.models.ProjectKey import from_dsn [as 别名]
def _get_project_key(self, request):
dsn = request.GET.get('dsn')
try:
key = ProjectKey.from_dsn(dsn)
except ProjectKey.DoesNotExist:
return
return key
示例2: _get_project_key
# 需要导入模块: from sentry.models import ProjectKey [as 别名]
# 或者: from sentry.models.ProjectKey import from_dsn [as 别名]
def _get_project_key(self, request):
try:
dsn = request.GET['dsn']
except KeyError:
return
try:
key = ProjectKey.from_dsn(dsn)
except ProjectKey.DoesNotExist:
return
return key
示例3: authenticate_credentials
# 需要导入模块: from sentry.models import ProjectKey [as 别名]
# 或者: from sentry.models.ProjectKey import from_dsn [as 别名]
def authenticate_credentials(self, token):
try:
key = ProjectKey.from_dsn(token)
except ProjectKey.DoesNotExist:
raise AuthenticationFailed('Invalid token')
if not key.is_active:
raise AuthenticationFailed('Invalid token')
with configure_scope() as scope:
scope.set_tag("api_token_type", self.token_name)
scope.set_tag("api_project_key", key.id)
return (AnonymousUser(), key)