Skip to content
Snippets Groups Projects
Commit 38e5c370 authored by Dirk Sarpe's avatar Dirk Sarpe
Browse files

prototype how to get events in close time period

missing:
- limit to x number of events
- creating a new list of events that match our criteria
- finally embed in website
parent 66b43cb6
No related branches found
No related tags found
No related merge requests found
import requests
import arrow
from ics import Calendar
url = 'https://portal.idiv.de/ssf/ical/basic.ics?bi=393&ui=1026&pd=171497477d81eb659bd832ffe26c8bfe39d65fc3&v=1'
tz = 'Europe/Berlin'
now = arrow.now(tz)
period = (now.floor('day'), now.replace(weeks=+2))
c = Calendar(requests.get(url).text)
for e in c.events:
if e.begin > period[0] and e.begin < period[1]:
print(e.name, e.begin.humanize(), e.location)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment