Skip to main content

Simple library to list and download files from Amazon S3.

Project description

s3-file-downloader

A simple Python library to list and download files from Amazon S3.
Supports both public (unsigned) and private (AWS credentials) buckets.


Features

  • List objects in an S3 bucket under a prefix
  • Download:
    • One file
    • Many files
    • All files under a prefix
  • Safe local filenames (handles weird S3 keys)
  • Works with public access or with your AWS credentials

Installation

From PyPI (after publishing):

pip install s3-file-downloader

For development (local install):

git clone https://github.com/<your-username>/s3-file-downloader.git
cd s3-file-downloader
pip install -e .

Usage Example

from s3_file_downloader import make_s3_client, S3Downloader

# Public access (no AWS credentials needed)
s3 = make_s3_client(region="us-east-1", unsigned=True)
dl = S3Downloader(s3)

bucket = "aws-bigdata-blog"
prefix = "artifacts/flink-refarch/data/nyc-tlc-trips.snz/"

# 1) List objects
keys = dl.list_objects(bucket=bucket, prefix=prefix, limit=5)
print("Found keys:", keys)

# 2) Download one file
if keys:
    dl.download_one(bucket, keys[0], "./downloads_one")

# 3) Download many files
dl.download_many(bucket, keys, "./downloads_many")

# 4) Download all files under prefix
dl.download_all_by_prefix(bucket, prefix, "./downloads_all", limit=None)

Requirements

  • Python 3.8+

  • boto3 (pip install boto3)

  • AWS credentials if accessing private buckets

    • Run aws configure or set environment variables:

      • AWS_ACCESS_KEY_ID
      • AWS_SECRET_ACCESS_KEY
      • AWS_SESSION_TOKEN (if required)

Authors


License

MIT License — free to use, copy, modify, and share.


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

s3_file_downloader-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

s3_file_downloader-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: s3_file_downloader-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for s3_file_downloader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 57e01abdae8863fda5fe131b68d2136abbc7c611933ccefafa39d951559dee13
MD5 97c284ac6bcc689b47ead2a42a871987
BLAKE2b-256 a04ed305a7622fb45484772d1e3644a1be00fcb42e4a6cf194c75abd522b1159

See more details on using hashes here.

File details

Details for the file s3_file_downloader-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for s3_file_downloader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78e113a980b11cbb9cc3fab61c9b2b4c2e97bb2187d10b025f5dfb4f70b3002d
MD5 9abca8cb2c6a5b938efa2f4245b0a9f9
BLAKE2b-256 20aa64a1a457f55fb5e3b598e342916b1053fec31709677e01e6e0c0bf9edf3c

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