Skip to main content

Exposing file sharing system

Project description

miniMinio

A thin python helper get either 1) local files or 2) Minio objects. 1) Heavily relies on the default os library while 2) is built off minio-py. The package is designed to provide a seamless switch between testing file operations locally/over a file system and interacting with a minio server when in deployment.

Installation

Use the package manager pip to install miniMinio.

pip install miniMinio

Usage

  1. Create a connection that returns a client
  2. Use client as a function input for subsequent functions
from miniMinio import create_connection

client = create_connection("some_hostname:port", "access_key", "secret_key")

# For filesystems
client = create_connection("local")

client = create_connection("remote")

####For filesystems:

'local' is designed to work when the working directory is at the directory equivalent to a Minio's bucket. Best suited for .exe files

'remote' gives the user the flexibility to specify the bucket.

object_names for file server operations replaces the S3 object naming convention with the absolute path of the object

i.e.

# Minio object name / Minio Bucket
"Book1.xlsx" / "example_bucket"
# File system object name equivalent
"usr/full/path/to/example_bucket/Book1.xlsx"

Filesystems do not need to specify bucket_name

Functions

all_buckets = get_buckets(client)

Returns all bucket name and creation date as a tuple

get_all_object_details_in_bucket(client, bucket_name=None, attributes=["object_name", "last_modified"], filter_object=("file", "folder"), filter_prefix='')

Returns all objects recursively within a specified bucket. Attributes supported Filter enables the user to filter the objects.

Supported filters ['file', 'folder', 'excel'].

Supported attributes (Only for Minio) ['etag', 'last_modified', 'size', 'content_type']

filter_prefix accepts an extension of the path from the bucket to form a new path. The resulting combined path will be the start point of the search

get_all_objects_from_bucket(client, bucket_name, object_name_list, file_path)

Transfers all objects in object_name_list to the desired file_path relative to the working directory

get_single_object_content_bytes(client, bucket_name, object_name)

Returns bytes of the selected object

get_single_excel_file_content(client, bucket_name, excel_file_object)

Returns an <xlrd.book.Book> object

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

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

miniMinio-0.1.5.tar.gz (187.7 kB view details)

Uploaded Source

File details

Details for the file miniMinio-0.1.5.tar.gz.

File metadata

  • Download URL: miniMinio-0.1.5.tar.gz
  • Upload date:
  • Size: 187.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.10

File hashes

Hashes for miniMinio-0.1.5.tar.gz
Algorithm Hash digest
SHA256 dd6ccf8089ad6b49c976da3fc39c8fae3c79259c04d7b9156c66c26734d0a609
MD5 2f4738dbf2e5ebcc6a39abb896c338a0
BLAKE2b-256 e1ce06f1e60fb0e5c0de5762dba84c9304481b9fd22fd804852a67f82040c375

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