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.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbde9c12b9729115a86c0d8c60706a24313fc635cf9429bac038a2da837f9cf4 |
|
MD5 | 1b72ae442d4ca1b39a51e88730900f23 |
|
BLAKE2b-256 | e08129920e205e06b0eeff346bb265d172a7ebcd7b19c7cd3f101eed6bffa080 |
Close
Hashes for simple_file_repository-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c72f229fd07768e6e5804e93a096e5ad85c1132a7cbbf11bbaf6b2cabbecb5c8 |
|
MD5 | 6e9477923da787ba8b41072319dd937e |
|
BLAKE2b-256 | 043cee205b945e050015c5c38fb0a2cfbda9f32fa837400ee4775496427e0ae7 |