summaryrefslogtreecommitdiff
path: root/services/news-collector/src/news_collector/collectors/base.py
blob: bb43fd6f2a1a94cc91c8b75076a4fa2ee0a5f08d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Base class for all news collectors."""

from abc import ABC, abstractmethod

from shared.models import NewsItem


class BaseCollector(ABC):
    name: str = "base"
    poll_interval: int = 300  # seconds

    @abstractmethod
    async def collect(self) -> list[NewsItem]:
        """Collect news items from the source."""

    @abstractmethod
    async def is_available(self) -> bool:
        """Check if this data source is accessible."""