pypicloud.storage.object_store module¶
Store packages in S3
- class pypicloud.storage.object_store.ObjectStoreStorage(request=None, expire_after=None, bucket_prefix=None, prepend_hash=None, redirect_urls=None, sse=None, object_acl=None, storage_class=None, region_name=None, public_url=False, **kwargs)[source]¶
Bases:
IStorage
Storage backend base class containing code that is common between supported object stores (S3 / GCS)
- download_response(package)[source]¶
Return a HTTP Response that will download this package
This is called from the download endpoint
- get_url(package)[source]¶
Create or return an HTTP url for a package file
By default this will return a link to the download endpoint
/api/package/<package>/<filename>
- Returns
- linkstr
Link to the location of this package file
- open(package)[source]¶
Get a buffer object that can read the package data
This should be a context manager. It is used in migration scripts, not directly by the web application.
- Parameters
- package
Package
- package
Examples
with storage.open(package) as pkg_data: with open('outfile.tar.gz', 'w') as ofile: ofile.write(pkg_data.read())