fabfile.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:sync-buckets-state-machine 作者: awslabs 项目源码 文件源码
def get_timestamp_from_s3_object(bucket, key):
    s3 = boto3.client('s3', region_name=AWS_DEFAULT_REGION)

    try:
        response = s3.get_object(
            Bucket=bucket,
            Key=key
        )
        timestamp = response['LastModified']  # We assume this is UTC.
    except ClientError:
        timestamp = datetime(1970, 1, 1, tzinfo=None)

    return (timestamp.replace(tzinfo=None) - datetime(1970, 1, 1, tzinfo=None)).total_seconds()


# IAM
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号