From 38e5c370ecb23f0ebe568133140326a883c7e01d Mon Sep 17 00:00:00 2001
From: Dirk Sarpe <dsarpe@posteo.de>
Date: Wed, 12 Apr 2017 03:58:19 +0200
Subject: [PATCH] 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
---
 prototype.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 prototype.py

diff --git a/prototype.py b/prototype.py
new file mode 100644
index 0000000..a1fc322
--- /dev/null
+++ b/prototype.py
@@ -0,0 +1,14 @@
+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)
-- 
GitLab