I want to use the requests library to perform a stream get.
My endpoint is a long-running process that dumps output in the form of plaintext lines like:
Done with operation 1
Done with operation 2
etc...
But this endpoint could run for 10-30 minutes and I would like to get feedback about its current state without having to wait the full 30 minutes. I looked into stream=True for requests, but either my python (<3.5) doesn't support it or my endpoint response format isn't formatted to allow for streaming.
Can anyone tell me if it's possible to do this with requests? I do not have support for the async keyword in my python version.
import requests
res = request.get(endpointUrl, stream=True)
# Code execution pauses here even with stream enabled
for line in res.iter_lines():
print(line) -> Expected: Done with operation 1