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.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc6413ee584013102ad41ab483b67e6596e67b5962db8f23de3cbda0a9dad99e |
|
MD5 | 81b992855209bc36c2f2dc4d485f51bb |
|
BLAKE2b-256 | 8a41a0e6049e1c1d52b2312e30263f7147232824f9fdfeff0ea73543f6f905da |
Close
Hashes for simple_file_repository-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66d90259b7e3e7a594767fe56d4dd51e505668631e938f4188bc6722e8eb5671 |
|
MD5 | d1d14ff08ce8abd501491d63cfed5db2 |
|
BLAKE2b-256 | 7dbe4178b262a6da2ff69d9af57e7bba78000bd40762808ed41c77e2e0052085 |