fix: Import aiohttp.web submodule directly
Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) <aider@aider.chat>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
from aiohttp import web
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import io
|
import io
|
||||||
@@ -86,7 +87,7 @@ async def monitor_garage_door(app):
|
|||||||
# --- Web Server ---
|
# --- Web Server ---
|
||||||
async def handle_root(request):
|
async def handle_root(request):
|
||||||
"""Handler for the root GET request."""
|
"""Handler for the root GET request."""
|
||||||
return aiohttp.web.Response(text="hello world")
|
return web.Response(text="hello world")
|
||||||
|
|
||||||
async def on_startup(app):
|
async def on_startup(app):
|
||||||
"""Actions to perform on application startup."""
|
"""Actions to perform on application startup."""
|
||||||
@@ -120,11 +121,11 @@ async def on_cleanup(app):
|
|||||||
logging.info("Cleanup complete.")
|
logging.info("Cleanup complete.")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
app = aiohttp.web.Application()
|
app = web.Application()
|
||||||
app.router.add_get('/', handle_root)
|
app.router.add_get('/', handle_root)
|
||||||
app.on_startup.append(on_startup)
|
app.on_startup.append(on_startup)
|
||||||
app.on_cleanup.append(on_cleanup)
|
app.on_cleanup.append(on_cleanup)
|
||||||
aiohttp.web.run_app(app)
|
web.run_app(app)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if not os.path.exists(MODEL_PATH):
|
if not os.path.exists(MODEL_PATH):
|
||||||
|
Reference in New Issue
Block a user