Commit 60741d10 by Juan

lo basico anda

1 parent ea08a711
# -*- coding: <UTF8> -*- # -*- coding: <UTF8> -*-
import requests import requests
import json import json
import base64
select = """SELECT dom.name as dominio, pf.create_date, pf.pfs_fecha, cli.name, cli.street, cli.street2, loc.name AS localidad, prov.name AS provincia, cli.zip AS codigo_postal, pais.name AS pais, pf.domicilio AS domicilio_pf FROM select = """SELECT dom.name as dominio, pf.create_date, pf.pfs_fecha, cli.name, cli.street, cli.street2, loc.name AS localidad, prov.name AS provincia, cli.zip AS codigo_postal, pais.name AS pais, pf.domicilio AS domicilio_pf FROM
( (
...@@ -30,4 +31,11 @@ var = json.dumps(parametros) ...@@ -30,4 +31,11 @@ var = json.dumps(parametros)
mpost = requests.post("http://127.0.0.1:11876/", data = var) mpost = requests.post("http://127.0.0.1:11876/", data = var)
#mpost = requests.post("http://192.168.15.69:8080", data = var) #mpost = requests.post("http://192.168.15.69:8080", data = var)
print(mpost.text)
\ No newline at end of file \ No newline at end of file
r = mpost.json()
print(r["Nombre"])
f = open(r["Nombre"], 'w+b')
File = r["Archivo"].encode('ascii')
File = base64.b64decode(File)
f.write(File)
f.close()
\ No newline at end of file \ No newline at end of file
No preview for this file type
import base64
import json
mime = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
def encodear(archivo):
data = open(archivo, "rb").read()
encoded = base64.b64encode(data)
nombre = archivo.split("/")
nombre = nombre[1]
r = { "Archivo": encoded.decode('ascii'), "Nombre": nombre, "Tipo": mime }
return(r)
\ No newline at end of file \ No newline at end of file
from Libmod.armador import NegroReport from Libmod.armador import NegroReport
from Libmod.funciones import encodear
from flask import Flask, send_file from flask import Flask, send_file
from flask import request from flask import request
from flask_restful import Resource, Api from flask_restful import Resource, Api
...@@ -18,8 +19,8 @@ class indice(Resource): ...@@ -18,8 +19,8 @@ class indice(Resource):
def post(self): def post(self):
content = json.loads(request.data) content = json.loads(request.data)
#print(content) archivo = self.acciones(content)
retorno = self.acciones(content) retorno = encodear(archivo)
return(retorno) return(retorno)
def acciones(self, content): def acciones(self, content):
......
,juan,juan-ThinkPad-X230,24.02.2020 14:04,file:///home/juan/.config/libreoffice/4;
\ No newline at end of file \ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!