Skip to main content

A simple file and photo repository.

Project description

Simple File Repository

Build PyPI

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_file_repository-0.9.0.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

simple_file_repository-0.9.0-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page