mirror of
https://github.com/flibusta-apps/library_updater.git
synced 2025-12-06 15:45:36 +01:00
Remove webhook
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user