示例#1
0
 def _metadata_file(self, path):
     resp = yield from self.make_request(
         'HEAD',
         self.bucket.new_key(path.path).generate_url(
             settings.TEMP_URL_SECS, 'HEAD'),
         expects=(200, ),
         throws=exceptions.MetadataError,
     )
     return S3FileMetadataHeaders(path.path, resp.headers)
示例#2
0
 def _metadata_file(self, path, revision=None):
     if revision == 'Latest':
         revision = None
     resp = yield from self.make_request(
         'HEAD',
         self.bucket.new_key(
             path.path
         ).generate_url(
             settings.TEMP_URL_SECS,
             'HEAD',
             query_parameters={'versionId': revision} if revision else None
         ),
         expects=(200, ),
         throws=exceptions.MetadataError,
     )
     return S3FileMetadataHeaders(path.path, resp.headers)
示例#3
0
    async def _metadata_file(self, path, revision=None):
        await self._check_region()

        if revision == 'Latest':
            revision = None
        resp = await self.make_request(
            'HEAD',
            functools.partial(self.bucket.new_key(path.path).generate_url,
                              settings.TEMP_URL_SECS,
                              'HEAD',
                              query_parameters={'versionId': revision}
                              if revision else None),
            expects=(200, ),
            throws=exceptions.MetadataError,
        )
        await resp.release()
        return S3FileMetadataHeaders(path.path, resp.headers)
示例#4
0
def file_metadata_headers_object(file_header_metadata):
    return S3FileMetadataHeaders('test-path', file_header_metadata)