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


Python rollbar.init方法代码示例

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


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

示例1: __exit__

# 需要导入模块: import rollbar [as 别名]
# 或者: from rollbar import init [as 别名]
def __exit__(self, exc_type, exc_value, traceback):
        """
        report any errors via rollbar and shut down
        :param exc_type:
        :param exc_value:
        :param traceback:
        :return:
        """
        if (exc_type is not None) and (self.environment == "production"):
            panoptes_file = open("/app/config/aggregation.yml","rb")
            api_details = yaml.load(panoptes_file)

            rollbar_token = api_details[self.environment]["rollbar"]
            rollbar.init(rollbar_token,self.environment)
            rollbar.report_exc_info()

        # calling the parent
        AggregationAPI.__exit__(self, exc_type, exc_value, traceback) 
开发者ID:zooniverse,项目名称:aggregation,代码行数:20,代码来源:text_aggregation.py

示例2: add_monitoring

# 需要导入模块: import rollbar [as 别名]
# 或者: from rollbar import init [as 别名]
def add_monitoring():
    rollbar.init(os.environ.get('ROLLBAR_SECRET'))
    ## delete the next line if you dont want this event anymore
    rollbar.report_message('Rollbar is configured correctly')
    got_request_exception.connect(rollbar.contrib.flask.report_exception, app) 
开发者ID:fullstackpython,项目名称:blog-code-examples,代码行数:7,代码来源:app.py

示例3: __s3_upload__

# 需要导入模块: import rollbar [as 别名]
# 或者: from rollbar import init [as 别名]
def __s3_upload__(self):
        """
        upload the file to s3
        see http://boto.cloudhackers.com/en/latest/s3_tut.html
        :return:
        """
        # s3 = boto3.resource('s3')
        s3,_ = self.__s3_connect__()

        aws_tar = self.__get_aws_tar_name__()

        b = s3.get_bucket('zooniverse-static')

        key_str = "panoptes-uploads.zooniverse.org/production/project_aggregations_export/"+aws_tar

        s3_key = Key(b)
        s3_key.key = key_str

        if not os.path.exists("/tmp/"+aws_tar):
            print("warning the tar file does not exist - creating an temporary one.")
            panoptes_file = open("/app/config/aggregation.yml","rb")
            api_details = yaml.load(panoptes_file)

            rollbar_token = api_details[self.environment]["rollbar"]
            rollbar.init(rollbar_token,self.environment)
            rollbar.report_message('the tar file does not exist', 'warning')
            with open("/tmp/"+aws_tar,"w") as f:
                f.write("")

        s3_key.set_contents_from_filename("/tmp/"+aws_tar) 
开发者ID:zooniverse,项目名称:aggregation,代码行数:32,代码来源:text_aggregation.py


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