From e21cbf17cc04127fb01764d4f97f5fbf0c68c339 Mon Sep 17 00:00:00 2001 From: Kurbanov Bulat Date: Sun, 9 Jan 2022 15:47:25 +0300 Subject: [PATCH] Remove webhook --- src/app/services/updaters/fl_updater.py | 3 --- src/app/services/webhook.py | 23 ----------------------- src/core/config.py | 4 +--- 3 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 src/app/services/webhook.py diff --git a/src/app/services/updaters/fl_updater.py b/src/app/services/updaters/fl_updater.py index 4315bff..ae1ac45 100644 --- a/src/app/services/updaters/fl_updater.py +++ b/src/app/services/updaters/fl_updater.py @@ -6,7 +6,6 @@ import aiomysql import asyncpg from app.services.updaters.base import BaseUpdater -from app.services.webhook import WebhookSender from core.config import env_config @@ -705,8 +704,6 @@ class FlUpdater(BaseUpdater): self._update_books_genres(), ) - await WebhookSender.send() - return True @classmethod diff --git a/src/app/services/webhook.py b/src/app/services/webhook.py deleted file mode 100644 index 1ef53d6..0000000 --- a/src/app/services/webhook.py +++ /dev/null @@ -1,23 +0,0 @@ -import httpx - -from core.config import env_config, WebhookConfig - - -class WebhookSender: - @classmethod - async def _make_request(cls, webhook: WebhookConfig): - print(f"Make request to {webhook.url}") - - async with httpx.AsyncClient() as client: - request_maker = getattr(client, webhook.method) - await request_maker(webhook.url, headers=webhook.headers) - - @classmethod - async def send(cls): - webhooks = env_config.WEBHOOKS - - if webhooks is None: - return - - for webhook in webhooks: - await cls._make_request(webhook) diff --git a/src/core/config.py b/src/core/config.py index 34c2176..9dcc632 100644 --- a/src/core/config.py +++ b/src/core/config.py @@ -1,4 +1,4 @@ -from typing import Optional, Union, Literal +from typing import Union, Literal from pydantic import BaseModel, BaseSettings @@ -26,7 +26,5 @@ class EnvConfig(BaseSettings): FL_BASE_URL: str - WEBHOOKS: Optional[list[WebhookConfig]] - env_config = EnvConfig()