Skip to content

Commit 617eab5

Browse files
committed
More naive way of fetching the next event
1 parent f510808 commit 617eab5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/calendar.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import random
2-
3-
import arrow
41
import httpx
52
from ics import Calendar, Event
63

74
from .config import CALENDAR_URL
85

96

107
def get_next_meeting() -> Event | None:
11-
url = f"{CALENDAR_URL}?c={random.randint(0, 9999)}"
12-
calendar = Calendar(httpx.get(url).text)
8+
calendar = Calendar(httpx.get(CALENDAR_URL).text)
139

14-
return next(calendar.timeline.start_after(arrow.now()), None)
10+
try:
11+
return list(calendar.events)[0]
12+
except IndexError:
13+
return None

0 commit comments

Comments
 (0)