Make a start on adding subscriptions

This commit is contained in:
Edward Betts 2023-11-05 22:44:50 +00:00
parent 98ed132430
commit 125eb245e9

25
agenda/subscription.py Normal file
View file

@ -0,0 +1,25 @@
"""Subscriptions."""
import yaml
from .types import Event
def get_events(filepath: str) -> list[Event]:
"""Get subscription renewal dates."""
events = []
with open(filepath) as f:
items = yaml.safe_load(f)
for item in items:
if "renewal_date" not in item:
continue
events.append(
Event(
date=item["renewal_date"],
name="subscription",
title=item["name"] + " renewal",
)
)
return events