add new endpoints for app v2 #116
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)
|
||||||
|
|
@ -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