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.7.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c44dd1c0d9ae14097d7ff1a977723bd669ad95f7269449a19d3543a0d4c9d5c0 |
|
MD5 | 12eb7c2af604d7e35ca79d6801e27851 |
|
BLAKE2b-256 | 450ea746b3390121cf1610b41350642d94eaa72b3890d2a51443e3be143a6fe6 |
Close
Hashes for simple_file_repository-0.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98ed991f49708003a809351cb85fa9f6fb326f224f4e1e551e530f9238757197 |
|
MD5 | 5c889b4d19d62b86a214bad8f5bcbcff |
|
BLAKE2b-256 | b4677c7e82eda00f94493fa2ad21a679bfa84f43197289918c197e28556213e0 |