当前位置: 首页>>代码示例>>Python>>正文


Python utils.parse_to_aware_datetime方法代码示例

本文整理汇总了Python中botocore.utils.parse_to_aware_datetime方法的典型用法代码示例。如果您正苦于以下问题:Python utils.parse_to_aware_datetime方法的具体用法?Python utils.parse_to_aware_datetime怎么用?Python utils.parse_to_aware_datetime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在botocore.utils的用法示例。


在下文中一共展示了utils.parse_to_aware_datetime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _run_main

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import parse_to_aware_datetime [as 别名]
def _run_main(self, args, parsed_globals):
        signer = CloudFrontSigner(
            args.key_pair_id, RSASigner(args.private_key).sign)
        date_less_than = parse_to_aware_datetime(args.date_less_than)
        date_greater_than = args.date_greater_than
        if date_greater_than is not None:
            date_greater_than = parse_to_aware_datetime(date_greater_than)
        if date_greater_than is not None or args.ip_address is not None:
            policy = signer.build_policy(
                args.url, date_less_than, date_greater_than=date_greater_than,
                ip_address=args.ip_address)
            sys.stdout.write(signer.generate_presigned_url(
                args.url, policy=policy))
        else:
            sys.stdout.write(signer.generate_presigned_url(
                args.url, date_less_than=date_less_than))
        return 0 
开发者ID:gkrizek,项目名称:bash-lambda-layer,代码行数:19,代码来源:cloudfront.py

示例2: _convert_timestamp_to_str

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import parse_to_aware_datetime [as 别名]
def _convert_timestamp_to_str(self, value):
        datetime_obj = parse_to_aware_datetime(value)
        converter = getattr(
            self, '_timestamp_%s' % self.TIMESTAMP_FORMAT.lower())
        final_value = converter(datetime_obj)
        return final_value 
开发者ID:skarlekar,项目名称:faces,代码行数:8,代码来源:serialize.py

示例3: _convert_header_value

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import parse_to_aware_datetime [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)
        else:
            return value 
开发者ID:skarlekar,项目名称:faces,代码行数:9,代码来源:serialize.py

示例4: _convert_timestamp_to_str

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import parse_to_aware_datetime [as 别名]
def _convert_timestamp_to_str(self, value, timestamp_format=None):
        if timestamp_format is None:
            timestamp_format = self.TIMESTAMP_FORMAT
        timestamp_format = timestamp_format.lower()
        datetime_obj = parse_to_aware_datetime(value)
        converter = getattr(
            self, '_timestamp_%s' % timestamp_format)
        final_value = converter(datetime_obj)
        return final_value 
开发者ID:QData,项目名称:deepWordBug,代码行数:11,代码来源:serialize.py

示例5: _convert_header_value

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import parse_to_aware_datetime [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 
开发者ID:QData,项目名称:deepWordBug,代码行数:15,代码来源:serialize.py

示例6: _convert_header_value

# 需要导入模块: from botocore import utils [as 别名]
# 或者: from botocore.utils import parse_to_aware_datetime [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 
开发者ID:VirtueSecurity,项目名称:aws-extender,代码行数:13,代码来源:serialize.py


注:本文中的botocore.utils.parse_to_aware_datetime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。