diff options
Diffstat (limited to 'bin/web_api.py')
-rwxr-xr-x | bin/web_api.py | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/bin/web_api.py b/bin/web_api.py index 0e0fd0b..e543d22 100755 --- a/bin/web_api.py +++ b/bin/web_api.py @@ -11,7 +11,7 @@ from homekit import http from homekit.config import config, is_development_mode from homekit.database import BotsDatabase, SensorsDatabase, InverterDatabase from homekit.database.inverter_time_formats import * -from homekit.api.types import BotType, TemperatureSensorLocation, SoundSensorLocation +from homekit.api.types import TemperatureSensorLocation, SoundSensorLocation from homekit.media import SoundRecordStorage @@ -126,30 +126,6 @@ class WebAPIServer(http.HTTPServer): BotsDatabase().add_sound_hits(hits, datetime.now()) return self.ok() - async def POST_bot_request_log(self, req: http.Request): - data = await req.post() - - try: - user_id = int(data['user_id']) - except KeyError: - user_id = 0 - - try: - message = data['message'] - except KeyError: - message = '' - - bot = BotType(int(data['bot'])) - - # validate message - if message.strip() == '': - raise ValueError('message can\'t be empty') - - # add record to the database - BotsDatabase().add_request(bot, user_id, message) - - return self.ok() - async def POST_openwrt_log(self, req: http.Request): data = await req.post() |