Skip to main content

Yet another simple S3 management tool for python.

Project description

YAS3 - Yet Another S3 Client

Yas3 is a simple client for managing buckets/storage in S3 (and S3 compatible endpoints) for people who don't want the complexity of learning boto3.

Uploading Objects

You can upload from Object paths:

with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
    conn.upload('test.txt', 'Object.txt', bucket='bucket')

Or as bytes:

with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
    conn.upload(Object_bytes, 'Object.txt', bucket='bucket', type='application/octet-stream')

The Object type is guessed using mimetypes, but it can be easily specified using mimetype='text/json'.

Downloading Objects

You can download the Object locally:

with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
    conn.download('Object.txt', 'test.txt', bucket='bucket')

Or you can get the response directly:

with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
    bucket_data = conn.get('Object.txt', bucket='bucket')
    print(bucket_data)

Object Operations

Moving Objects:

with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
    conn.move('Object.txt', 'new_Object.txt', source_bucket='bucket', target_bucket='bucket')

Copying Objects:

with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
    conn.copy('Object.txt', 'new_Object.txt', source_bucket='bucket', target_bucket='bucket')

Deleting Objects:

with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
    conn.delete('Object.txt', bucket='bucket')

Listing Objects in a bucket

with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
    conn.list_Objects(bucket='bucket', prefix=None)

Using it as an object

If you want to create an object, feel free:

conn = yas3.Connection(...)
...
conn.close()

Full Docs

See the full API documentation here.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yas3-1.0.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

yas3-1.0-py3-none-any.whl (9.1 kB view hashes)

Uploaded Python 3

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