def info(self, path, refresh=False, **kwargs):
""" Detail on the specific file pointed to by path.
Gets details only for a specific key, directories/buckets cannot be
used with info.
"""
parent = path.rsplit('/', 1)[0]
files = self._lsdir(parent, refresh=refresh)
files = [f for f in files if f['Key'] == path and f['StorageClass'] not
in ['DIRECTORY', 'BUCKET']]
if len(files) == 1:
return files[0]
else:
try:
bucket, key = split_path(path)
out = self._call_s3(self.s3.head_object,
kwargs, Bucket=bucket, Key=key, **self.req_kw)
out = {'ETag': out['ETag'], 'Key': '/'.join([bucket, key]),
'LastModified': out['LastModified'],
'Size': out['ContentLength'], 'StorageClass': "STANDARD"}
return out
except (ClientError, ParamValidationError):
raise FileNotFoundError(path)
评论列表
文章目录