One of the endpoints of my flask API makes a long request to a Live Stream. Here is an example of the code:
@app.route('/stream')
def live_stream(sensor_id):
stream = requests.get('stream_url', stream=True)
return Response(stream_with_context(stream.iter_content(chunk_size=2048)),
content_type=stream.headers['content-type'])
This route is working fine and the stream goes well. However, when I try to make requests to another routes it seems like the server get stucked at this endpoint.
I'm using a gevent WSGI server:
http_server = WSGIServer(('0.0.0.0', 5000), app).serve_forever()
And I'm making the requests from a template already returned by a Flask route.
How can I make parallel requests to the API without get stucked on that?