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.9.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b12605ebd8957f52fe2f2b43c8629ed34e0700b229d972cedab5017e264e3e6b |
|
MD5 | 26a7e8f72e085c6dbff7c22e6f850183 |
|
BLAKE2b-256 | ab800ab351e3b8c709777622b8654fc2abfd6b11b18d8a5880e4b24980ebf5c9 |
Close
Hashes for simple_file_repository-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65f558451a8532cdbc3fe51a365cd2d42bf201cb7e943e3b25169ec27ff2ea16 |
|
MD5 | 3423ce7aa78c9811297822dcedf060ad |
|
BLAKE2b-256 | 3b830171f616c31295c981ad7aef75422cb108b3e5095f4dc0c7ff209989932b |