From da5db8bc280deab0e2081f39d2f32aabb2372afe Mon Sep 17 00:00:00 2001 From: Evgeny Sorokin Date: Tue, 16 Jan 2024 02:05:00 +0300 Subject: wip --- include/py/homekit/http/http.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/py/homekit/http/http.py') diff --git a/include/py/homekit/http/http.py b/include/py/homekit/http/http.py index 3e70751..9b76d9a 100644 --- a/include/py/homekit/http/http.py +++ b/include/py/homekit/http/http.py @@ -1,6 +1,7 @@ import logging import asyncio +from enum import Enum from aiohttp import web from aiohttp.web import Response from aiohttp.web_exceptions import HTTPNotFound @@ -104,3 +105,8 @@ class HTTPServer: def plain(self, text: str): return Response(text=text, content_type='text/plain') + + +class HTTPMethod(Enum): + GET = 'GET' + POST = 'POST' -- cgit v1.2.3 From 8a89dd77be03ca8eb9cdc378ba8e912292494fa9 Mon Sep 17 00:00:00 2001 From: Evgeny Sorokin Date: Tue, 16 Jan 2024 03:31:55 +0300 Subject: inverter page --- include/py/homekit/http/http.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/py/homekit/http/http.py') diff --git a/include/py/homekit/http/http.py b/include/py/homekit/http/http.py index 9b76d9a..82c5aae 100644 --- a/include/py/homekit/http/http.py +++ b/include/py/homekit/http/http.py @@ -3,7 +3,7 @@ import asyncio from enum import Enum from aiohttp import web -from aiohttp.web import Response +from aiohttp.web import Response, HTTPFound from aiohttp.web_exceptions import HTTPNotFound from ..util import stringify, format_tb, Addr @@ -21,6 +21,9 @@ async def errors_handler_middleware(request, handler): except HTTPNotFound: return web.json_response({'error': 'not found'}, status=404) + except HTTPFound as exc: + raise exc + except Exception as exc: _logger.exception(exc) data = { -- cgit v1.2.3