當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。