We upload files through an API endpoint that replies with a 307 redirect
to a presigned storage URL. To show a progress bar we wrap the file object
with tqdm.wrapattr before passing it as data=:
import os
import requests
from tqdm import tqdm
with open("testfile.txt", "rb") as f:
with tqdm.wrapattr(f, "read", total=os.path.getsize("testfile.txt")) as wrapped:
requests.put("https://your-api.example.com/upload", data=wrapped, timeout=30)
After upgrading this library from 2.33.1 to 2.34.0, the redirected request
sends an empty/consumed body. The server receives no data and the request
eventually times out:
requests.exceptions.ReadTimeout: HTTPSConnectionPool(...): Read timed out. (read timeout=30)
Passing the raw file object (no progress wrapper) still works fine on
2.34.0, and the wrapped upload worked fine on 2.33.1. Endpoints that don't
redirect are also unaffected.