当前位置: 首页>>代码示例>>Python>>正文


Python ProjectKey.get_default方法代码示例

本文整理汇总了Python中sentry.models.ProjectKey.get_default方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectKey.get_default方法的具体用法?Python ProjectKey.get_default怎么用?Python ProjectKey.get_default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sentry.models.ProjectKey的用法示例。


在下文中一共展示了ProjectKey.get_default方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: project_key

# 需要导入模块: from sentry.models import ProjectKey [as 别名]
# 或者: from sentry.models.ProjectKey import get_default [as 别名]
    def project_key(self):
        from sentry.models import ProjectKey

        if not settings.SENTRY_PROJECT:
            return None

        key = None
        try:
            if settings.SENTRY_PROJECT_KEY is not None:
                key = ProjectKey.objects.get(
                    id=settings.SENTRY_PROJECT_KEY,
                    project=settings.SENTRY_PROJECT,
                )
            else:
                key = ProjectKey.get_default(settings.SENTRY_PROJECT)
        except Exception as exc:
            # if the relation fails to query or is missing completely, lets handle
            # it gracefully
            self.error_logger.warn('internal-error.unable-to-fetch-project', extra={
                'project_id': settings.SENTRY_PROJECT,
                'project_key': settings.SENTRY_PROJECT_KEY,
                'error_message': six.text_type(exc),
            })
        if key is None:
            self.error_logger.warn('internal-error.no-project-available', extra={
                'project_id': settings.SENTRY_PROJECT,
                'project_key': settings.SENTRY_PROJECT_KEY,
            })
        return key
开发者ID:mjumbewu,项目名称:sentry,代码行数:31,代码来源:raven.py

示例2: get

# 需要导入模块: from sentry.models import ProjectKey [as 别名]
# 或者: from sentry.models.ProjectKey import get_default [as 别名]
    def get(self, request, project):
        data = options.get('sentry:docs')
        project_key = ProjectKey.get_default(project)

        context = {
            'platforms': data['platforms'],
        }
        if project_key:
            context['dsn'] = project_key.dsn_private
            context['dsnPublic'] = project_key.dsn_public

        return Response(context)
开发者ID:AyrtonRicardo,项目名称:sentry,代码行数:14,代码来源:project_docs.py

示例3: send

# 需要导入模块: from sentry.models import ProjectKey [as 别名]
# 或者: from sentry.models.ProjectKey import get_default [as 别名]
    def send(self, **kwargs):
        # Report the issue to an upstream Sentry if active
        # NOTE: we don't want to check self.is_enabled() like normal, since
        # is_enabled behavior is overridden in this class. We explicitly
        # want to check if the remote is active.
        if self.remote.is_active():
            from sentry import options
            # Append some extra tags that are useful for remote reporting
            super_kwargs = copy.deepcopy(kwargs)
            super_kwargs['tags']['install-id'] = options.get('sentry:install-id')
            super(SentryInternalClient, self).send(**super_kwargs)

        if not is_current_event_safe():
            return

        # These imports all need to be internal to this function as this class
        # is set up by django while still parsing LOGGING settings and we
        # cannot import this stuff until settings are finalized.
        from sentry.models import ProjectKey
        from sentry.web.api import StoreView
        from django.test import RequestFactory
        key = None
        if settings.SENTRY_PROJECT_KEY is not None:
            key = ProjectKey.objects.filter(
                id=settings.SENTRY_PROJECT_KEY,
                project=settings.SENTRY_PROJECT).first()
        if key is None:
            key = ProjectKey.get_default(settings.SENTRY_PROJECT)
        if key is None:
            return

        client_string = 'raven-python/%s' % (raven.VERSION,)
        headers = {
            'HTTP_X_SENTRY_AUTH': get_auth_header(
                protocol=self.protocol_version,
                timestamp=time.time(),
                client=client_string,
                api_key=key.public_key,
                api_secret=key.secret_key,
            ),
            'HTTP_CONTENT_ENCODING': self.get_content_encoding(),
        }
        self.request_factory = self.request_factory or RequestFactory()
        request = self.request_factory.post(
            '/api/store',
            data=self.encode(kwargs),
            content_type='application/octet-stream',
            **headers
        )
        StoreView.as_view()(
            request,
            project_id=six.text_type(settings.SENTRY_PROJECT),
        )
开发者ID:binlee1990,项目名称:sentry,代码行数:55,代码来源:raven.py

示例4: get

# 需要导入模块: from sentry.models import ProjectKey [as 别名]
# 或者: from sentry.models.ProjectKey import get_default [as 别名]
    def get(self, request, project, platform):
        data = load_doc(platform)
        if not data:
            raise ResourceDoesNotExist

        project_key = ProjectKey.get_default(project)

        return Response({
            'id': data['id'],
            'name': data['name'],
            'html': replace_keys(data['html'], project_key),
            'link': data['link'],
        })
开发者ID:ForkRepo,项目名称:sentry,代码行数:15,代码来源:project_docs_platform.py

示例5: get

# 需要导入模块: from sentry.models import ProjectKey [as 别名]
# 或者: from sentry.models.ProjectKey import get_default [as 别名]
    def get(self, request, project):
        data = load_doc('_platforms')
        if data is None:
            raise RuntimeError('Docs not built')
        project_key = ProjectKey.get_default(project)

        context = {
            'platforms': data['platforms'],
        }
        if project_key:
            context['dsn'] = project_key.dsn_private
            context['dsnPublic'] = project_key.dsn_public

        return Response(context)
开发者ID:280185386,项目名称:sentry,代码行数:16,代码来源:project_docs.py


注:本文中的sentry.models.ProjectKey.get_default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。