-
Notifications
You must be signed in to change notification settings - Fork 0
/
feed.py
41 lines (34 loc) · 1.05 KB
/
feed.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""GDACS feed."""
import logging
from typing import Dict, List, Tuple
from aio_georss_client.feed import GeoRssFeed
from aio_georss_client.xml_parser.feed_item import FeedItem
from aiohttp import ClientSession
from .consts import URL
from .feed_entry import GdacsFeedEntry
_LOGGER = logging.getLogger(__name__)
class GdacsFeed(GeoRssFeed[GdacsFeedEntry]):
"""GDACS feed."""
def __init__(
self,
websession: ClientSession,
home_coordinates: Tuple[float, float],
filter_radius: float = None,
filter_categories: List[str] = None,
):
"""Initialise this service."""
super().__init__(
websession,
home_coordinates,
URL,
filter_radius=filter_radius,
filter_categories=filter_categories,
)
def _new_entry(
self,
home_coordinates: Tuple[float, float],
feature: FeedItem,
global_data: Dict,
) -> GdacsFeedEntry:
"""Generate a new entry."""
return GdacsFeedEntry(home_coordinates, feature)