Skip to main content

Read and write to Amazon S3 using a file-like object

Project description

Read and write files to S3 using a file-like object. Refer to S3 buckets and keys using full URLs.

More tests and docs are needed.

Requirements

boto

Usage

Basic usage:

from s3file import s3open

f = s3open("http://mybucket.s3.amazonaws.com/myfile.txt")
f.write("Lorem ipsum dolor sit amet...")
f.close()

S3 authentication key and secret may be passed into the s3open method or stored in the boto config file.:

f = s3open("http://mybucket.s3.amazonaws.com/myfile.txt", key, secret)

Other parameters to s3open include:

expiration_days

Sets the number of days that the remote file should be cached by clients. Default is 0, not cached.

private

If True, sets the file to be private. Defaults to False, publicly readable.

content_type

The content_type of the file will be guessed from the URL, but you can explicitly set it by passing a content_type value.

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

python-s3file-0.1.tar.gz (3.1 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