當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。