本文整理汇总了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)
示例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)
示例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)