本文整理匯總了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)