A simple file and photo repository.
Project description
Simple File Repository
A simple file and photo repository. Underlying storage is a filesystem or a S3-compatible service.
Installation
pip install simple_file_repository
Usage
File storage
>>> import uuid
>>> from simple_file_repository import FileStorage
>>> storage = FileStorage(storage_directory='/tmp/repo', database='cats')
>>> storage.store(b'content')
UUID('72fc4a76-1ab7-4d60-9f6a-94aa0ad45b5b')
>>> storage.get(uuid.UUID(hex='72fc4a76-1ab7-4d60-9f6a-94aa0ad45b5b'))
b'content'
>>> list(storage.list())
['72fc4a76-1ab7-4d60-9f6a-94aa0ad45b5b']
Photo storage using S3
from simple_file_repository import PhotoStorages
storages = PhotoStorages()
storages.init_app(names=['cats', 'dogs'],
storage_directory='/tmp/repo',
names_for_s3=['cats'],
imagemagick_convert='/usr/bin/convert',
access_key_id='',
secret_access_key='',
region='us-east-1', bucket='my-s3-bucket')
storages['cats'].store(b'image')
License
MIT
Project details
Release history Release notifications | RSS feed
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 simple_file_repository-0.10.0.tar.gz
.
File metadata
- Download URL: simple_file_repository-0.10.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab523e86ecf03720d0b18984d8d98681be6eb9533e6915a28f134ccb596e14d5 |
|
MD5 | fc3cc3ec8f75b08e346b9c997aae25ea |
|
BLAKE2b-256 | c10b751a40812dcf20555b7f0aa4b9929acee572b6d2bab4ec7b937e8f97ca9e |
File details
Details for the file simple_file_repository-0.10.0-py3-none-any.whl
.
File metadata
- Download URL: simple_file_repository-0.10.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c71b4c98ab4df9d9c483cbf6d341e45e0b35ef3777158513cd7cf8ea5be4473 |
|
MD5 | 99cb47e67ffeeb01a1fd75624a76457a |
|
BLAKE2b-256 | 33190e3fc8764227a5f3ddc794c09a8a4250bedd0e325aff75173efa8bd07705 |