Python raven 模块,fetch_git_sha() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用raven.fetch_git_sha()

项目:startupintro    作者:ShubhamBansal1997    | 项目源码 | 文件源码
def get_release():
    import startupintro
    import raven
    from raven import exceptions as raven_exceptions
    release = startupintro.__version__
    try:
        git_hash = raven.fetch_git_sha(os.path.dirname(os.pardir))[:7]
        release = '{}-{}'.format(release, git_hash)
    except raven_exceptions.InvalidGitRepository:
        pass
    return release
项目:perdiem-django    作者:RevolutionTech    | 项目源码 | 文件源码
def RAVEN_CONFIG(self):
        if not hasattr(self, 'RAVEN_SECRET_KEY'):
            return {}
        return {
            'dsn': 'https://{public_key}:{secret_key}@app.getsentry.com/{project_id}'.format(
                public_key=self.RAVEN_PUBLIC_KEY,
                secret_key=self.RAVEN_SECRET_KEY,
                project_id=self.RAVEN_PROJECT_ID
            ),
            'release': raven.fetch_git_sha(self.TOP_DIR),
        }

    # Email