Remove webhook

This commit is contained in:
2022-01-09 15:47:25 +03:00
parent cdd4582b39
commit e21cbf17cc
3 changed files with 1 additions and 29 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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()