Skip to main content

Tiny wrapper for basic S3 functions in boto3

Project description

PyS3

Minimal wrapper for S3 functionality in boto3.

Installation

pip install pys3

Example

from pys3 import PyS3

# Local file
file = PyS3('/path/to/file.txt', 'w')
file.write('Hello World!')
file.close()

# File on S3
file = PyS3('s3://bucket_name/path/to/file.txt', 'w')
file.write('Hello World!')
file.close()

Prerequisites

pys3 uses boto3 as a back-end. Thus, credentials for AWS must be set up according to that framework. For example, place the acces key ID and secret key in the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

How it works

Upon creation of a PyS3 file object, it is checked whether the passed file URL refers to a location on S3. If so, a local copy of the file is downloaded (provided it exists). When the close() method is called, any modifications to the local file are uploaded.

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

pys3-0.0.4.tar.gz (2.4 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