Cliente.py 1.34 KB
# -*- coding: <UTF8> -*-
import requests 
import json

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 
(
	(koozo_planillafosa AS pf LEFT JOIN account_invoice AS comp ON pf.pfs_acc_inv = comp.id) 
	LEFT JOIN 
	res_partner AS cli ON comp.partner_id = cli.id
	LEFT JOIN
	res_country_state AS prov ON prov.id = cli.state_id
	LEFT JOIN
	res_country AS pais ON pais.id = cli.country_id
	LEFT JOIN
	koozo_dominios AS dom ON dom.id = comp.ain_dom_id
	LEFT JOIN
	koozo_localidad AS loc ON loc.id = cli.par_loc_id OR loc.id = pf.pfs_loc_id
) WHERE  pf."tws_Tipo" = 'cent' AND pf.create_date >= '01/01/2019 12:00:00 AM' AND pf.create_date <= '01/02/2020 12:00:00 AM'"""

titulos = ["DOMINIO", "DATETIME", "FECHA", "CLENTE", "CALLE", "CALLE2", "LOCALIDAD", "PROBINCIA", "COD POSTAL", "PAIS", "DOMICILIO"]

Configuracion =  {"usuario": "administrador", "pass": "administrador", "puerto": 5432, "db": "isvareporte", "host": "127.0.0.1"}

parametros = {
    "DBconf": Configuracion,
    "Titulos": titulos,
    "select" : select
    }
var = json.dumps(parametros)

mpost = requests.post("http://127.0.0.1:11876/", data = var)
#mpost = requests.post("http://192.168.15.69:8080", data = var)
print(mpost.text)