-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.py
More file actions
30 lines (22 loc) · 704 Bytes
/
Copy pathapi.py
File metadata and controls
30 lines (22 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import json
import re
import time
import csv
from flask import Flask, jsonify, request
app = Flask(__name__)
employees = [ { 'id': 1, 'name': 'Ashley' }, { 'id': 2, 'name': 'Kate' }, { 'id': 3, 'name': 'Joe' }]
@app.route('/', methods=['GET'])
def get_employees():
header = []
rows = []
with open("analyzer_v1.3.py", 'r') as f:
source_code = f.read()
exec(source_code)
with open('anlyzer_results.csv', newline='') as csvfile:
csvreader = csv.reader(csvfile, delimiter=';')
header = next(csvreader)
for row in csvreader:
rows.append(row)
return jsonify(header, rows)
if __name__ == '__main__':
app.run(debug=True, port=5000)