I am new to flask. I am trying to write a flask web service to parse files(txt files) and get results. Using postman send files to flask.
How can I read a file and encoding it (like io.open(file, 'r', encoding = 'utf-16')) from the request and retrieve the content to parse it?
Here is my code:
app=Flask(__name__)
@app.route('/process', methods=['GET', 'POST'])
def post_data():
if request.method == "POST":
files = request.files.getlist("file")
for file in files:
print(file.data)
#.....do some processing
return ""
if __name__ == '__main__':
app.run(host= '127.0.0.1', port= 5000)