예제 #1
0
def updater():
    try:
        r = requests.get("https://www.kora.work/api/updated/" + device_idn,
                         headers=header,
                         timeout=10)
        print(r.text)
        status = json.loads(r.text)
        if status['success']:
            os.system("python3 /home/pi/koraupdate/updater.py")
        threading.Timer(600, updater).start()
    except:
        pass


threading.Timer(0, updater).start()

dbMain.databaseInit()
dbMotion.checkTable()
dbActivity.checkTable()
dbRecognition.checkTable()
getEncodings.checkTable()

getEncodings.refreshEncodings(auth_token, header, device_idn)

sendToServer()
laptop.sendActivity(device_idn)

laptop.saveEncodings()
laptop.startRecognition(device_idn)
예제 #2
0
import psycopg2
from psycopg2 import Error
from psycopg2 import sql
import time
from datetime import datetime
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
import databaseMain as DB
import requests
from logfile import *

log_init()

DB.databaseInit()


def checkTable():
    try:
        connection = psycopg2.connect(user="******",
                                      password="******",
                                      host="127.0.0.1",
                                      port="5432",
                                      database="raspberry")
        cursor = connection.cursor()
        cursor.execute("SELECT 'public.activitytable'::regclass")
    except:
        connection = psycopg2.connect(user="******",
                                      password="******",
                                      host="127.0.0.1",
                                      port="5432",
                                      database="raspberry")
        cursor = connection.cursor()