From fe194ca9e8af217bfac27523dc0540f21bf4e634 Mon Sep 17 00:00:00 2001 From: odysseusmax Date: Sat, 19 Sep 2020 17:01:57 +0530 Subject: [PATCH] fix unused imports --- app/main.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/app/main.py b/app/main.py index 60a03cc..bb0e670 100644 --- a/app/main.py +++ b/app/main.py @@ -5,7 +5,6 @@ import logging import aiohttp_jinja2 import jinja2 from aiohttp import web -from aiohttp_basicauth import BasicAuthMiddleware from .telegram import Client from .routes import setup_routes @@ -17,32 +16,32 @@ log = logging.getLogger(__name__) class Indexer: - + TEMPLATES_ROOT = pathlib.Path(__file__).parent / 'templates' - + def __init__(self): self.server = web.Application() self.loop = asyncio.get_event_loop() self.tg_client = Client(session_string, api_id, api_hash) - - + + async def startup(self): await self.tg_client.start() log.debug("telegram client started!") - + await setup_routes(self.server, Views(self.tg_client)) - + loader = jinja2.FileSystemLoader(str(self.TEMPLATES_ROOT)) aiohttp_jinja2.setup(self.server, loader=loader) - + self.server.on_cleanup.append(self.cleanup) - - + + async def cleanup(self, *args): await self.tg_client.disconnect() log.debug("telegram client disconnected!") - - + + def run(self): self.loop.run_until_complete(self.startup()) web.run_app(self.server, host=host, port=port)