Receiving and then Serving image files
So I get an image file with the following sample URL (http://localhost:8096/image/blah). I would like to then serve this image via a flask route.
So I have at the moment
@app.route('/image/blah')
def __blahimage():
import requests
r = requests.get('http://localhost:8096/image/blah')
#Response 200
return send_file(r.text)
This does not seem to be the correct way. I'm new to Python in general and the reason I'm doing this is because the images are available on a local server only. The flask is a wrapper essentially.
/r/flask
https://redd.it/cfka7t
So I get an image file with the following sample URL (http://localhost:8096/image/blah). I would like to then serve this image via a flask route.
So I have at the moment
@app.route('/image/blah')
def __blahimage():
import requests
r = requests.get('http://localhost:8096/image/blah')
#Response 200
return send_file(r.text)
This does not seem to be the correct way. I'm new to Python in general and the reason I'm doing this is because the images are available on a local server only. The flask is a wrapper essentially.
/r/flask
https://redd.it/cfka7t
reddit
r/flask - Receiving and then Serving image files
2 votes and 8 comments so far on Reddit