Exemplo n.º 1
0
import subprocess
import threading
from sql_conexion import Conexion_fetchdata
from adq_date import get_date

CLSS_CON=Conexion_fetchdata()
arr=[]
fecha=""
time=""

def date():
    global fecha,time
    fecha,time=get_date()

td=threading.Thread(target=date)
td.start()

text = subprocess.run(['curl', '-m', '5','http://mcmb.ddns.net/fetch'], stdout=subprocess.PIPE)
r=str(text.stdout)
r_check=r.replace("'","").replace("b","")

if(r_check == ""):
    print("humd=N/C&temp=N/C&lumi=N/C")
else:
    arr.append("Myron")
    arr.append(r[r.find("Humedad:"):len(r)])
    arr[1] = arr[1][0:arr[1].find("\\n")]
    arr[1] = arr[1][arr[1].find(":")+2:len(arr[1])]
    if(arr[1] == "0"): arr[1] = "No"
    else: arr[1] = "Si"
Exemplo n.º 2
0
import sys
from sql_conexion import Conexion_fetchdata

CLSS_CON = Conexion_fetchdata()

arr = []
ars = []
name = sys.argv[1]
type_op = sys.argv[2]

arr = CLSS_CON.fetch(type_op, name, name)
for i in range(0, len(arr)):
    tmp = ",".join(arr[i])
    ars.append(tmp)

out = ";".join(ars)
print(out)