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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: simple-file-repository-0.7.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.9.13 Linux/5.15.0-1019-azure

File hashes

Hashes for simple-file-repository-0.7.0.tar.gz
Algorithm Hash digest
SHA256 c44dd1c0d9ae14097d7ff1a977723bd669ad95f7269449a19d3543a0d4c9d5c0
MD5 12eb7c2af604d7e35ca79d6801e27851
BLAKE2b-256 450ea746b3390121cf1610b41350642d94eaa72b3890d2a51443e3be143a6fe6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simple_file_repository-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98ed991f49708003a809351cb85fa9f6fb326f224f4e1e551e530f9238757197
MD5 5c889b4d19d62b86a214bad8f5bcbcff
BLAKE2b-256 b4677c7e82eda00f94493fa2ad21a679bfa84f43197289918c197e28556213e0

See more details on using hashes here.

Supported by

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