Skip to main content

A Python library that allows you to interact with Amazon S3 Buckets as if they are your local filesystem.

Project description

s3monkey: Access your S3 buckets like they’re native files ========-=================================================

Platforms like Heroku don’t allow for FUSE filesystem usage, so I had to get a bit creative.

Introducing, s3monkey, a library that mocks out all standard Python library system file operations, allowing you to use already–written code to interface with Amazon S3.

All standard library file operation modules are patched when using the provided context manager, including os, io, & pathlib.

Usage

AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are expected to be set:

$ AWS_ACCESS_KEY_ID=xxxxxxxxxxx
$ AWS_SECRET_ACCESS_KEY=xxxxxxxxxxx

Basic usage:

from s3monkey import S3FS

with S3FS(bucket='media.kennethreitz.com', mount_point='/app/data') as fs:

    # Create a 'test' key on S3, with the contents of 'hello'.
    with open('/app/data/test', 'w') as f:
        f.write('hello')

    # List the keys in the S3 bucket.
    print(os.listdir('/app/data'))
    # ['file1.txt', 'file2.txt', 'file2.txt', 'test', …]

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

s3monkey-0.1.0.tar.gz (59.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

s3monkey-0.1.0-py2.py3-none-any.whl (129.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file s3monkey-0.1.0.tar.gz.

File metadata

  • Download URL: s3monkey-0.1.0.tar.gz
  • Upload date:
  • Size: 59.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for s3monkey-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1cce9afafa09566b835190ca37d3249b542573232a3ac519cbef62ce90595c35
MD5 673edbcf53c7e30c85bbfe0de3b2e04d
BLAKE2b-256 9a2570336a0a01179f03e6e0ba8dfe8b670c0fba28f0909fa4f96c7f2d5e18fb

See more details on using hashes here.

File details

Details for the file s3monkey-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for s3monkey-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f9a5fcd58de0eae436ac31a51e8c687258f37fcf9fae56e53cae5df223a4e924
MD5 53059de8d7c630fd7ddad96940a95044
BLAKE2b-256 d7b0aa475c8173adb2411f2300a98bda8a9a96551469c54880f0db4e8dd78752

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