Browse Source

test script to create calendars

Bastien Sevajol (Algoo) 8 years ago
parent
commit
169500ff5c
1 changed files with 30 additions and 0 deletions
  1. 30 0
      tracim/test_create_cal.py

+ 30 - 0
tracim/test_create_cal.py View File

@@ -0,0 +1,30 @@
1
+import caldav
2
+from radicale import ical
3
+
4
+#
5
+# Run it in gearbox command with app context (radicale must running)
6
+# pip package caldav==0.4.0 must be installed
7
+# run following
8
+
9
+
10
+client = caldav.DAVClient('http://127.0.0.1:5232',
11
+                          username='admin@admin.admin',
12
+                          password='admin@admin.admin')
13
+
14
+calendar = caldav.Calendar(
15
+    parent=client,
16
+    client=client,
17
+    id='/user/1.ics/',
18
+    # url='http://127.0.0.1:5232/user/1.ics/'
19
+)
20
+
21
+calendar.save()
22
+
23
+# FOR EACH EVENT IN THIS CALENDAR:
24
+
25
+coll = ical.Collection.from_path('/user/1.ics/')[0]
26
+with coll.filesystem_only():
27
+    coll.append(name='THE EVENT NAME (ID)', text='THE ICS EVENT RAW')
28
+
29
+
30
+pass