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.6.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dc9a8ad760c80874ab54dc5c1c3d664013a687ef71247fa87a4e1790a1f4a87 |
|
MD5 | a1c78f731f83675a5f1bbbaaaebf988a |
|
BLAKE2b-256 | 5a20d369ed1b069720eee2db0f39f8b2e7348d0e593c833cfb4411c6314f6458 |
Close
Hashes for simple_file_repository-0.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9909c625e751c3c4aae178f7c56a82ef0613f6b136654f6145f20a55042b88af |
|
MD5 | 4ecd28ac0db7d293a1193d24ece20508 |
|
BLAKE2b-256 | 0f0ea38ece56d1b937a8788438cd7ecb289454f3c35b69f211948d8f9bad78a5 |