main.py
1.13 KB
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
40
41
42
43
44
45
46
from Libmod.armador import NegroReport
from Libmod.funciones import encodear
from flask import Flask, send_file
from flask import request
from flask_restful import Resource, Api
from flask import jsonify
import json
import datetime
app = Flask(__name__)
api = Api(app)
class indice(Resource):
def get(self):
datetime_object = datetime.datetime.now()
print(datetime_object)
hora = str(datetime_object)
return({"hora":hora})
def post(self):
content = json.loads(request.data)
archivo = self.acciones(content)
retorno = encodear(archivo)
return(retorno)
def acciones(self, content):
rep = NegroReport()
rep.ConfiguradorDB(content["DBconf"])
rep.Encabezado(content)
rep.DB.SELECT = content["select"]
retorno = rep.Generador()
del(rep)
return(retorno)
class icono(Resource):
def get(self):
return send_file("imagen/icon.ico")
api.add_resource(indice, "/")
api.add_resource(icono, "/favicon.ico")
if __name__ == '__main__':
app.run(threaded=False, processes=3,
debug=False, port=11876, host="0.0.0.0")