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

Uploaded Source

Built Distribution

simple_file_repository-0.4.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file simple-file-repository-0.4.0.tar.gz.

File metadata

  • Download URL: simple-file-repository-0.4.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Linux/5.4.0-1047-azure

File hashes

Hashes for simple-file-repository-0.4.0.tar.gz
Algorithm Hash digest
SHA256 fbde9c12b9729115a86c0d8c60706a24313fc635cf9429bac038a2da837f9cf4
MD5 1b72ae442d4ca1b39a51e88730900f23
BLAKE2b-256 e08129920e205e06b0eeff346bb265d172a7ebcd7b19c7cd3f101eed6bffa080

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for simple_file_repository-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c72f229fd07768e6e5804e93a096e5ad85c1132a7cbbf11bbaf6b2cabbecb5c8
MD5 6e9477923da787ba8b41072319dd937e
BLAKE2b-256 043cee205b945e050015c5c38fb0a2cfbda9f32fa837400ee4775496427e0ae7

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