add new endpoints for app v2 #116

Merged
edenhaus merged 17 commits from ecovacs-home into master 2021-06-05 15:06:19 +02:00
Showing only changes of commit c726381ebe - Show all commits

View file

@ -1,17 +1,15 @@
#!/usr/bin/env python3
import asyncio
from aiohttp import web
from bumper import plugins
import logging
import bumper
from bumper.models import *
from bumper import plugins
from datetime import datetime, timedelta
import os
import string
import random
import string
import xml.etree.ElementTree as ET
from aiohttp import web
from bumper import plugins
from bumper.models import *
class portal_api_lg(plugins.ConfServerApp):
def __init__(self):
@ -28,10 +26,11 @@ class portal_api_lg(plugins.ConfServerApp):
self.get_milli_time = bumper.ConfServer.ConfServer_GeneralFunctions().get_milli_time
async def handle_lg_log(self, request): # EcoVacs Home
randomid = "".join(random.sample(string.ascii_letters, 6))
try:
json_body = json.loads(await request.text())
randomid = "".join(random.sample(string.ascii_letters, 6))
did = json_body["did"]
botdetails = bumper.bot_get(did)
@ -98,11 +97,12 @@ class portal_api_lg(plugins.ConfServerApp):
json_body["toId"]
)
)
body = {"id": randomid, "errno": bumper.ERR_COMMON, "ret": "fail"}
return web.json_response(body)
except Exception as 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()