[Python] cancel S3 Download in python

Discussão em 'Python' iniciado por Stack, Junho 18, 2025.

  1. Stack

    Stack Membro Participativo

    I have a client app, that downloads potentially big files from S3. I want to give the user the option to cancel that download, without stopping/killing the whole app. Doing some research, that seems to be an suprisingly different task:

    • boto3 does not support canceling S3 downloads :(.
    • I could start a process (using Python multiprocessing) - and kill it to cancel the download. But I fear that would probably leave large chunks already in memory but not saved to the file "lost".
    • I could use some http library and "manual" download the file. If that library supports canceling, that could work. But I also did not find another http library, that supports canceling get requests in progress.

    So my questions, aimed at archiving cancelable downloads from S3.

    • Am I right, that running the download in a separate process and killing it could drop larger chunks already download (or other problems)?
    • Did I miss a python http library that supports canceling?
    • Is there another way, to cancel S3 downloads in Python that I may have missed?

    Continue reading...

Compartilhe esta Página