ICS to CalDAV synchronisation.
Project description
ICS to CalDAV synchronisation
Downloads a calendar in ICS format and uploads it to a CalDAV server, regularly. Your employee, school, or whoever shares a calendar as a link to an ICS file and you'd like to have it on another CalDAV server? Look no further.
Standalone usage
Install the script with pip install . and run ics_caldav_sync script
which should be on your PATH now.
There also exist Dockerfile and docker-compose.yml files so you can
run it on your Docker server.
Set the settings as environment variables:
- REMOTE_URL (str): ICS file URL.
- LOCAL_URL (str): CalDAV URL.
- LOCAL_CALENDAR_NAME (str): The name of your CalDAV calendar.
- LOCAL_USERNAME (str): CalDAV username.
- LOCAL_PASSWORD (str): CalDAV password.
- LOCAL_AUTH (str, optional): CalDAV authentication method (either basic or digest). Default: basic.
- REMOTE_USERNAME (str, optional): ICS host username.
- REMOTE_PASSWORD (str, optional): ICS host password.
- REMOTE_AUTH (str, optional): ICS host authentication method (either basic or digest). Default: basic.
- TIMEZONE (str, optional): Override events timezone. (Example timezones: Utc, Europe/Warsaw, Asia/Tokyo).
- SYNC_EVERY (str): How often should the synchronisation occur? For example: 2 minutes, 1 hour. Synchronise once if empty.
- DEBUG (bool, optional): Set to anything to print debugging messages. Please set this when reporting an error.
- SYNC_ALL (bool, optional): If set, all events in the calendar will be synced. Otherwise, only the ones occuring in the future will be.
- KEEP_LOCAL (bool, optional): Do not delete events on the CalDAV server that do not exist in the ICS file.
Library usage
This script can be also used as a library in your Python script using ICSToCalDAVSync
class and its synchronise method.
def ICSToCalDAVSync.__init__(
self,
*,
remote_url: str,
local_url: str,
local_calendar_name: str,
local_username: str,
local_password: str,
local_auth: str = "basic",
remote_username: str = "",
remote_password: str = "",
remote_auth: str = "basic",
sync_all: bool = False,
keep_local: bool = False,
timezone: str | None = None,
)
def ICSToCalDavSync.synchronise(self):
"""
The main function which:
1) Pulls the events from the remote calendar,
2) Saves them into the local calendar,
3) Removes local events which are not in the remote any more.
If sync_all is set, all events will be pulled. Otherwise, only
the ones occuring after now will be.
"""
Examples
Docker-compose and Baikal
services:
ics_caldav_sync:
image: ics_caldav_sync
restart: unless-stopped
environment:
- REMOTE_URL=https://example.com/path/to/calendar_file.ics
- LOCAL_URL=https://baikal.myserver.com/dav.php/
- LOCAL_CALENDAR_NAME=My Calendar
- LOCAL_USERNAME=myusername
- LOCAL_PASSWORD=mypassword
- LOCAL_AUTH=digest # Required by Baikal - try removing if getting Unauthorized error
- SYNC_EVERY=30 minutes
Command-line usage
ics_caldav_sync can be also used from the command line. An example:
REMOTE_URL=https://example.com/path/to/calendar_file.ics \
LOCAL_URL=https://baikal.myserver.com/dav.php \
LOCAL_CALENDAR_NAME="My Calendar" \
LOCAL_USERNAME=myusername \
LOCAL_PASSWORD=mypassword \
ics_caldav_sync
Rationale
In my case, my new shiny Bluetooth wristwatch, Casio Edifice ECB-10, did not support synchronisation with calendar subscriptions. And so this script was created.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ics_caldav_sync-1.0.tar.gz.
File metadata
- Download URL: ics_caldav_sync-1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2307884904c87a792d566aade47440dfd07aa8f10059f964ec145ebfede7fb5f
|
|
| MD5 |
4e36d90e663fd489f67cfcc2fe3ad590
|
|
| BLAKE2b-256 |
49b690c1051725c48adb3408d292318611152ab08111b49f9639da02ebc32cb1
|
File details
Details for the file ics_caldav_sync-1.0-py3-none-any.whl.
File metadata
- Download URL: ics_caldav_sync-1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b1a3e38eca5d6a4b830d9a4aca4d705b016d4cba5624dc2a9852df349caaa4f
|
|
| MD5 |
32d7ac9ef8db0a99998aaa1a557eaf56
|
|
| BLAKE2b-256 |
242efbd95e1138af713ca2242d2dabc70d0b07e1e88fdeb82fa2df5e618f6024
|