I have a simple streaming server providing mjpeg streams (https://blog.miguelgrinberg.com/post/video-streaming-with-flask/page/3). When accessing the mjpeg data via browser it works as expected. I see a webcam stream.
If I do a get request via python (using python requests: http://requests.readthedocs.io/) I neither get any response (also tested with Insomnia REST Client) nor a status code/exception.
requests.get(url)
What I want to do is to write a proxy script (in python) which simply forwards the mjpeg stream.
The
requests
library is probably not the right option for forwarding a video stream, since you'll have to fetch a chunk of video, then somehow interpret that as video and then turn that BACK into a stream that you can put on a network. Furthermore, your video is likely NOT being streamed over HTTP, which is the protocolrequests.get
supports. The best option would be to simply set up your computer as a proxy server: http://www.aboutdebian.com/proxy.htm, that way a packet basically gets written to and read from a socket, just rewriting the high-layer info such as where to send the packet, without having to interpret the guts of the packet.That said, if you really want to do what you are suggesting, and in the unlikely event that the video is somehow being streamed over HTTP, you want
stream=True