I have written a Flask app to upload an image file. The route is as follows
@app.route('/upload', methods=['POST'])
def upload_files():
if 'file' in request.files:
filename = request.files['file']
filename.save('images/uploaded.jpg')
return 'Uploaded'
else:
return 'Not uploaded'
I am testing this route using the following file.
import requests
url = 'http://localhost:8080/upload'
files = {'file':open('pexels.jpg','rw')}
r = requests.post(url, files=files)
print(r.text)
When I run the test I get the following Warning and it gets stuck.
WARNING 2017-05-17 14:37:11,214 urlfetch_stub.py:534] Stripped prohibited headers from URLFetch request: ['Host', 'Content-Length']