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
import miniMinio

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

# For filesystems
client = functions.create_connection("local")

client = functions.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"))

Returns all objects 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']

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.1.tar.gz (188.5 kB view hashes)

Uploaded Source

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