A Python package that exposes a consistent API for working with different storage backends.
Project description
python-file-storage
A Python package that exposes a consistent API for working with different storage backends.
WARNING: This is still under active development.
Why does this package exist?
I needed something that does not depend on Django but exposes a similar
interface to Django's base storage in django.core.files.storage.base.Storage
.
So, if you're using Django: use Django and django-storages instead.
Currently, this package only does the bare minimum that I need it for so
if you're looking for something more full-featured perhaps look at the
cloudstorage package.
Available backends
- Filesystem.
- Amazon S3.
Quickstart
-
Install the package:
pip install python-file-storage
-
Add your configuration. Set the following as environment variables or add them to a
.env
file in the root of your project:DEFAULT_STORAGE_BACKEND = storage.backends.s3.S3Storage S3_BUCKET_NAME = my-bucket-name S3_ENDPOINT_URL = example.com # Optional S3_ACCESS_KEY_ID = 123 S3_SECRET_ACCESS_KEY = 123
Currently, using more than one storage backend at a time is unsupported.
-
Import
default_storage
and start using the package:from storage import default_storage default_storage.save('example.txt', 'Content') file = default_storage.open('example.txt', 'Content')
Compatibility
- Python 3.8+
- Django is unsupported.
Versioning
This project follows semantic versioning (SemVer).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file python-file-storage-0.3.0.tar.gz
.
File metadata
- Download URL: python-file-storage-0.3.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b382161d56c17e55228129cd54b82b9d53e8532a50209e429c784eec97254b13 |
|
MD5 | de77624cd182cbd57dca69c72e7e22cc |
|
BLAKE2b-256 | 184a8c313baa99db0d6eab51b02eecebe511de8ea55e4615f1c4cc91c6957337 |
File details
Details for the file python_file_storage-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: python_file_storage-0.3.0-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf1d4448485aa7d4bdd715e211a7b43aec061cd81eab860c771b05c7c8e31ac0 |
|
MD5 | 1dff697941189b2626c7c1c7dd54fce6 |
|
BLAKE2b-256 | 24c03735499655fcc26c2f518724999d6868056f98b9ea56c3ff07a8e3336b5a |