diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-06-11 02:07:51 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-06-11 02:07:51 +0300 |
commit | 1d0b9c5d1c90c4f7c7a6eb0c3cf32ffb843f2533 (patch) | |
tree | eca16553441cbaf89db54ac6e0ad4d8ccc831c4a /bin/web_api.py | |
parent | 00b3cd120f6357a35ef7e8b1c3ffad458a068266 (diff) |
telegram bots: get rid of requests logging via webapi
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() |