本文整理匯總了Python中botocore.utils.is_json_value_header方法的典型用法代碼示例。如果您正苦於以下問題:Python utils.is_json_value_header方法的具體用法?Python utils.is_json_value_header怎麽用?Python utils.is_json_value_header使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類botocore.utils
的用法示例。
在下文中一共展示了utils.is_json_value_header方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _get_value_for_special_type
# 需要導入模塊: from botocore import utils [as 別名]
# 或者: from botocore.utils import is_json_value_header [as 別名]
def _get_value_for_special_type(self, shape, special_type_map):
if is_json_value_header(shape):
return special_type_map['jsonvalue_header']
for special_type, marked_shape in self._context[
'special_shape_types'].items():
if special_type in special_type_map:
if shape == marked_shape:
return special_type_map[special_type]
return None
示例2: _convert_header_value
# 需要導入模塊: from botocore import utils [as 別名]
# 或者: from botocore.utils import is_json_value_header [as 別名]
def _convert_header_value(self, shape, value):
if shape.type_name == 'timestamp':
datetime_obj = parse_to_aware_datetime(value)
timestamp = calendar.timegm(datetime_obj.utctimetuple())
timestamp_format = shape.serialization.get(
'timestampFormat', self.HEADER_TIMESTAMP_FORMAT)
return self._convert_timestamp_to_str(timestamp, timestamp_format)
elif is_json_value_header(shape):
# Serialize with no spaces after separators to save space in
# the header.
return self._get_base64(json.dumps(value, separators=(',', ':')))
else:
return value
示例3: _check_special_validation_cases
# 需要導入模塊: from botocore import utils [as 別名]
# 或者: from botocore.utils import is_json_value_header [as 別名]
def _check_special_validation_cases(self, shape):
if is_json_value_header(shape):
return self._validate_jsonvalue_string
示例4: _unpack_cli_arg
# 需要導入模塊: from botocore import utils [as 別名]
# 或者: from botocore.utils import is_json_value_header [as 別名]
def _unpack_cli_arg(argument_model, value, cli_name):
if is_json_value_header(argument_model):
return _unpack_json_cli_arg(argument_model, value, cli_name)
elif argument_model.type_name in SCALAR_TYPES:
return unpack_scalar_cli_arg(
argument_model, value, cli_name)
elif argument_model.type_name in COMPLEX_TYPES:
return _unpack_complex_cli_arg(
argument_model, value, cli_name)
else:
return six.text_type(value)
示例5: _get_argument_type_name
# 需要導入模塊: from botocore import utils [as 別名]
# 或者: from botocore.utils import is_json_value_header [as 別名]
def _get_argument_type_name(self, shape, default):
if is_json_value_header(shape):
return 'JSON'
return default
示例6: _convert_header_value
# 需要導入模塊: from botocore import utils [as 別名]
# 或者: from botocore.utils import is_json_value_header [as 別名]
def _convert_header_value(self, shape, value):
if shape.type_name == 'timestamp':
datetime_obj = parse_to_aware_datetime(value)
timestamp = calendar.timegm(datetime_obj.utctimetuple())
return self._timestamp_rfc822(timestamp)
elif is_json_value_header(shape):
# Serialize with no spaces after separators to save space in
# the header.
return self._get_base64(json.dumps(value, separators=(',', ':')))
else:
return value