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
Close
Hashes for simple_file_repository-0.8.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a484cd87f0c268867d824602533991fce3584e950b8603da301f8290aed570ec |
|
MD5 | ffbfb6f919a8726bdf94e34f455e15cb |
|
BLAKE2b-256 | e7a5ad25477f5e9612c0d37938d201048a9dc43f9f45d9b05c8ce527d7de95a1 |
Close
Hashes for simple_file_repository-0.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0de55c15298acdd2352e205eb589a6900656d6841271773d1770bf09f94663a |
|
MD5 | e18996ba419a9c554e32996a8d6b4aa5 |
|
BLAKE2b-256 | 9d28a7f6a03ddc00e70e895f952f11f0cc955122bd242b65b55fec9462718137 |