Skip to main content

Download images from s3 fast

Project description

Download/upload images from/to s3 very quickly

Setup

poetry install

Usage

Download image files

from PIL import Image
from fast_s3 import Fetcher, Status


large_list_of_image_paths = [...]

fetcher = Fetcher(
    paths=large_list_of_image_paths,
    endpoint_url="https://s3.my-path-to-s3",
    aws_access_key_id="my-key-id",
    aws_secret_access_key="my-secret-key",
    region_name="my-region",
    bucket_name="my-bucket",
    ordered=True,  # returns files in the same order as paths
    buffer_size=1024,
    n_workers=32,
)

for file in fetcher:
    if file.status != Status.error:
        Image.open(file.buffer).save(file.path)

fetcher.close()

Upload files

from fast_s3 import Uploader


large_list_of_files = [...]
large_list_of_paths = [...]

uploader = Uploader(
    endpoint_url="https://s3.my-path-to-s3",
    aws_access_key_id="my-key-id",
    aws_secret_access_key="my-secret-key",
    region_name="my-region",
    bucket_name="my-bucket",
)

uploader.queue_upload(
    source=large_list_of_files,
    destination=large_list_of_paths,
)
uploader.await_upload()
uploader.close()

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

fast_s3-3.0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

fast_s3-3.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file fast_s3-3.0.1.tar.gz.

File metadata

  • Download URL: fast_s3-3.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.8.18 Linux/6.5.0-1025-azure

File hashes

Hashes for fast_s3-3.0.1.tar.gz
Algorithm Hash digest
SHA256 e9cc3e31d37105397f41c58430ac1c0b9ad5e56c0cec7a7c5538b066cf314a4a
MD5 c7db5dd8aac09b6bbc4316a9ece5a678
BLAKE2b-256 ee99df258d292cfa069fa5c6764ca6af78774495362021ae6fa65e7ad9f02aa3

See more details on using hashes here.

File details

Details for the file fast_s3-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: fast_s3-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.8.18 Linux/6.5.0-1025-azure

File hashes

Hashes for fast_s3-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d55fed6162e9972b98761fcc9ed4357d5800b25846e090cdaabdb2ec72d07f5
MD5 36f3336fa6fface4918e16caa49810aa
BLAKE2b-256 ac242f3df2679152f160add96371c72b0b5b82176c360c8d3b196d39ca6c41d1

See more details on using hashes here.

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