I have just started working on Flask and Python. I am building an API server in which I am trying to read a csv file and display the output of csv file on /osdata at port 8080.
There might be some issue in returning the data from function. Any help would be appreciated.
from flask import Flask, request
from flask_restful import Resource, Api
import json, csv
app = Flask(__name__)
app.config["DEBUG"] = True
api = Api(app)
@app.route('/', methods=['GET'])
def home():
return "1 2 3 Start"
@app.route('/osdata', methods=['GET'])
def osdata():
with open("Output_data.csv", "r") as f:
data = csv.reader(f, delimiter = "~")
line_count = 0
for row in data:
print(row)
line_count += 1
return(row)
if __name__ == '__main__':
app.run(port=8080)