Пример #1
0
def commandRegister(token):
    url = env.URL_BASE + '/v1/controller/register'
    sysInfo = getSystemInfo()
    payload = sysInfo.getInfoJSON()
    payload['token'] = token
    r = requests.post(url, data=json.dumps(payload))
    return statusHandler(r)
Пример #2
0
def sysBoot():
    url = env.URL_BASE + '/v1/controller/boot'
    sysInfo = getSystemInfo()
    payload = sysInfo.getInfoJSON()
    r = requests.post(url, data=json.dumps(payload))
    print('sysBoot request')
    print(json.dumps(payload))
    return statusHandler(r)
Пример #3
0
def sysinfoUpdate():
    url = env.URL_BASE + '/v1/controller/sysinfo/update'
    sysInfo = getSystemInfo()
    payload = {
        'id': str(sysInfo.hardwarehash),
        'ip': str(sysInfo.network.ip_local),
        'upgrade': str(sysInfo.VERSION)
    }
    r = requests.post(url, data=json.dumps(payload))
    return statusHandler(r)
Пример #4
0
def commandUpdate(commandId, result, message):
    url = env.URL_BASE + '/v1/controller/command/update'
    sysInfo = getSystemInfo()
    payload = {
        'id': str(sysInfo.hardwarehash),
        'commandId': str(commandId),
        'result': str(result),
        'message': str(message)
    }
    r = requests.post(url, data=json.dumps(payload))
    return statusHandler(r)
Пример #5
0
def startServer():
    sysInfo = getSystemInfo()
    http = HTTPServer((sysInfo.network.ip_local, 28080), RESTHandler)
    print('Server ready to start')
    http.serve_forever()
    print('Server started')
Пример #6
0
def commandGet():
    url = env.URL_BASE + '/v1/controller/command/get'
    sysInfo = getSystemInfo()
    payload = {'id': str(sysInfo.hardwarehash)}
    r = requests.post(url, data=json.dumps(payload))
    return statusHandler(r)