本文整理匯總了Python中boto3.set_stream_logger方法的典型用法代碼示例。如果您正苦於以下問題:Python boto3.set_stream_logger方法的具體用法?Python boto3.set_stream_logger怎麽用?Python boto3.set_stream_logger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類boto3
的用法示例。
在下文中一共展示了boto3.set_stream_logger方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get
# 需要導入模塊: import boto3 [as 別名]
# 或者: from boto3 import set_stream_logger [as 別名]
def get(self, path=""):
"""
Takes a path and returns lists of files/objects
and directories/prefixes based on the path.
"""
boto3.set_stream_logger("boto3.resources", logging.DEBUG)
boto3.set_stream_logger("botocore", logging.DEBUG)
try:
if not self.s3:
self.s3 = S3Resource(self.config).s3_resource
result = get_s3_objects_from_path(self.s3, path)
except S3ResourceNotFoundException as e:
print(e)
result = {
"error": 404,
"message": "The requested resource could not be found.",
}
except Exception as e:
print(e)
result = {"error": 500, "message": str(e)}
self.finish(json.dumps(result))
示例2: session
# 需要導入模塊: import boto3 [as 別名]
# 或者: from boto3 import set_stream_logger [as 別名]
def session(self):
'''Get a low-level session object or create one if needed'''
if not self._session:
if self.config.debug_mode:
boto3.set_stream_logger(level=log.DEBUG)
self._session = boto3.session.Session(
region_name=self.region_name, **self.session_cfg)
return self._session
示例3: sync
# 需要導入模塊: import boto3 [as 別名]
# 或者: from boto3 import set_stream_logger [as 別名]
def sync(config, parameter, suffix, debug, confirm, yes):
confirm = confirm or yes
if debug:
LOGGER.setLevel(logging.DEBUG)
boto3.set_stream_logger(name='boto3', level=logging.DEBUG)
boto3.set_stream_logger(name='botocore', level=logging.DEBUG)
else:
LOGGER.setLevel(logging.INFO)
if confirm:
LOGGER.info("This action will modify AWS infrastructure in account: {0}".format(
get_first_account_alias_or_account_id()))
else:
check_update_available()
click.confirm('This action will modify AWS infrastructure in account: {0}\nAre you sure?'.format(
get_first_account_alias_or_account_id()), abort=True)
try:
config = Config(config_file=config, cli_params=parameter, stack_name_suffix=suffix)
StackActionHandler(config).create_or_update_stacks()
except CfnSphereException as e:
LOGGER.error(e)
if debug:
LOGGER.exception(e)
sys.exit(1)
except Exception as e:
LOGGER.error("Failed with unexpected error")
LOGGER.exception(e)
LOGGER.info("Please report at https://github.com/cfn-sphere/cfn-sphere/issues!")
sys.exit(1)
示例4: __init__
# 需要導入模塊: import boto3 [as 別名]
# 或者: from boto3 import set_stream_logger [as 別名]
def __init__(self, region, retries=100):
boto3.set_stream_logger('boto3', logging.INFO)
self.session = boto3.Session()
self.region = region
self.retries = retries
self._ec2_client = None
self._ec2_resource = None
self._cloudwatch_client = None
self._iam_client = None
示例5: experiment_obj
# 需要導入模塊: import boto3 [as 別名]
# 或者: from boto3 import set_stream_logger [as 別名]
def experiment_obj(sagemaker_boto_client):
description = "{}-{}".format("description", str(uuid.uuid4()))
boto3.set_stream_logger("", logging.INFO)
experiment_obj = experiment.Experiment.create(
experiment_name=name(), description=description, sagemaker_boto_client=sagemaker_boto_client
)
yield experiment_obj
time.sleep(0.5)
experiment_obj.delete()