return fail if we can't get clean logs
This commit is contained in:
parent
4d0a42887f
commit
c726381ebe
1 changed files with 20 additions and 20 deletions
|
|
@ -1,17 +1,15 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import asyncio
|
|
||||||
from aiohttp import web
|
|
||||||
from bumper import plugins
|
|
||||||
import logging
|
import logging
|
||||||
import bumper
|
|
||||||
from bumper.models import *
|
|
||||||
from bumper import plugins
|
|
||||||
from datetime import datetime, timedelta
|
|
||||||
import os
|
|
||||||
import string
|
|
||||||
import random
|
import random
|
||||||
|
import string
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
from aiohttp import web
|
||||||
|
|
||||||
|
from bumper import plugins
|
||||||
|
from bumper.models import *
|
||||||
|
|
||||||
|
|
||||||
class portal_api_lg(plugins.ConfServerApp):
|
class portal_api_lg(plugins.ConfServerApp):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
@ -28,10 +26,11 @@ class portal_api_lg(plugins.ConfServerApp):
|
||||||
self.get_milli_time = bumper.ConfServer.ConfServer_GeneralFunctions().get_milli_time
|
self.get_milli_time = bumper.ConfServer.ConfServer_GeneralFunctions().get_milli_time
|
||||||
|
|
||||||
async def handle_lg_log(self, request): # EcoVacs Home
|
async def handle_lg_log(self, request): # EcoVacs Home
|
||||||
|
randomid = "".join(random.sample(string.ascii_letters, 6))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
json_body = json.loads(await request.text())
|
json_body = json.loads(await request.text())
|
||||||
|
|
||||||
randomid = "".join(random.sample(string.ascii_letters, 6))
|
|
||||||
did = json_body["did"]
|
did = json_body["did"]
|
||||||
|
|
||||||
botdetails = bumper.bot_get(did)
|
botdetails = bumper.bot_get(did)
|
||||||
|
|
@ -53,7 +52,7 @@ class portal_api_lg(plugins.ConfServerApp):
|
||||||
json_body["payloadType"] = "x"
|
json_body["payloadType"] = "x"
|
||||||
|
|
||||||
if not "payload" in json_body:
|
if not "payload" in json_body:
|
||||||
#json_body["payload"] = ""
|
# json_body["payload"] = ""
|
||||||
if json_body["td"] == "GetCleanLogs":
|
if json_body["td"] == "GetCleanLogs":
|
||||||
json_body["td"] = "q"
|
json_body["td"] = "q"
|
||||||
json_body["payload"] = '<ctl count="30"/>'
|
json_body["payload"] = '<ctl count="30"/>'
|
||||||
|
|
@ -77,8 +76,8 @@ class portal_api_lg(plugins.ConfServerApp):
|
||||||
"area": l.attrib['a'],
|
"area": l.attrib['a'],
|
||||||
"last": l.attrib['l'],
|
"last": l.attrib['l'],
|
||||||
"cleanType": l.attrib['t'],
|
"cleanType": l.attrib['t'],
|
||||||
#imageUrl allows for providing images of cleanings, something to look into later
|
# imageUrl allows for providing images of cleanings, something to look into later
|
||||||
#"imageUrl": "https://localhost:8007",
|
# "imageUrl": "https://localhost:8007",
|
||||||
}
|
}
|
||||||
logs.append(cleanlog)
|
logs.append(cleanlog)
|
||||||
body = {
|
body = {
|
||||||
|
|
@ -98,11 +97,12 @@ class portal_api_lg(plugins.ConfServerApp):
|
||||||
json_body["toId"]
|
json_body["toId"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
body = {"id": randomid, "errno": bumper.ERR_COMMON, "ret": "fail"}
|
|
||||||
return web.json_response(body)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception("{}".format(e))
|
logging.exception("{}".format(e))
|
||||||
|
|
||||||
plugin = portal_api_lg()
|
body = {"id": randomid, "errno": bumper.ERR_COMMON, "ret": "fail"}
|
||||||
|
return web.json_response(body)
|
||||||
|
|
||||||
|
|
||||||
|
plugin = portal_api_lg()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue