-
Notifications
You must be signed in to change notification settings - Fork 3
/
MAIN_FLASK_SERVER.py
39 lines (33 loc) · 1.25 KB
/
MAIN_FLASK_SERVER.py
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
30
31
32
33
34
35
36
37
38
39
from flask import Flask
from flask import request
from flask import send_file
from flask import send_from_directory
import pandas as pd
from zipfile import ZipFile
from main import *
app = Flask(__name__)
def handle_request(sampleType, whichState, sampleTechnique, sampleSize,
informationType, outputType):
result = main(sampleType, whichState, sampleTechnique, sampleSize,
informationType, outputType)
return result
@app.route('/')
def hello_world():
return 'Hello World'
@app.route('/getfile', methods=['GET', 'POST'])
def getfile():
if request.method == 'POST':
json = request.get_json()
sampleType = json['data']['sampleType']
whichState = json['data']['whichState']
sampleTechnique = json['data']['sampleTechnique']
sampleSize = json['data']['sampleSize']
informationType = json['data']['informationType']
outputType = json['data']['outputType']
result = [sampleType, whichState, sampleTechnique, sampleSize,
informationType, outputType]
output = handle_request(sampleType, whichState, sampleTechnique, sampleSize,
informationType, outputType)
return "works"
else:
return "response"