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.10.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

simple_file_repository-0.10.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file simple_file_repository-0.10.0.tar.gz.

File metadata

File hashes

Hashes for simple_file_repository-0.10.0.tar.gz
Algorithm Hash digest
SHA256 ab523e86ecf03720d0b18984d8d98681be6eb9533e6915a28f134ccb596e14d5
MD5 fc3cc3ec8f75b08e346b9c997aae25ea
BLAKE2b-256 c10b751a40812dcf20555b7f0aa4b9929acee572b6d2bab4ec7b937e8f97ca9e

See more details on using hashes here.

Provenance

File details

Details for the file simple_file_repository-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_file_repository-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c71b4c98ab4df9d9c483cbf6d341e45e0b35ef3777158513cd7cf8ea5be4473
MD5 99cb47e67ffeeb01a1fd75624a76457a
BLAKE2b-256 33190e3fc8764227a5f3ddc794c09a8a4250bedd0e325aff75173efa8bd07705

See more details on using hashes here.

Provenance

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