tst_create_cal.py 689B

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