Stop downloading or uploading a file.

This method must be called inside a progress callback function in order to stop the transmission at the desired time. The progress callback is called every time a file chunk is uploaded/downloaded.


from pyrogram import Client

app = Client("my_account")

# Example to stop transmission once the upload progress reaches 50%
# Useless in practice, but shows how to stop on command
def progress(client, current, total):
    if (current * 100 / total) > 50:

with app:
    app.send_document("me", "", progress=progress)