diff options
author | Yannis Mitsos <yannis@mitsos.net> | 2018-03-09 21:25:46 +0200 |
---|---|---|
committer | Yannis Mitsos <yannis@mitsos.net> | 2018-03-09 21:25:46 +0200 |
commit | cd9e84ac5392686d7b862bc181786a19e38a0fc8 (patch) | |
tree | 630369d5a97cec8172429f823fc46e037b8e241c | |
parent | ccfdd7315797a99f82a7c616c42c9313b2e556c6 (diff) | |
download | calendar-cli-cd9e84ac5392686d7b862bc181786a19e38a0fc8.zip |
Include a flag to ommit METHOD property from a request
-rwxr-xr-x | calendar-cli.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/calendar-cli.py b/calendar-cli.py index 7edd613..925e276 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python2 """ calendar-cli.py - high-level cli against caldav servers @@ -140,6 +140,9 @@ def _calendar_addics(caldav_conn, ics, uid, args): return c = find_calendar(caldav_conn, args) + if re.search(r'^METHOD:[A-Z]+[\r\n]+',ics,flags=re.MULTILINE) and args.ignoremethod: + ics = re.sub(r'^METHOD:[A-Z]+[\r\n]+', '', ics, flags=re.MULTILINE) + print ("METHOD property found and ignored") c.add_event(ics) def calendar_addics(caldav_conn, args): @@ -749,6 +752,7 @@ def main(): parser.add_argument("--ssl-verify-cert", help="verification of the SSL cert - 'yes' to use the OS-provided CA-bundle, 'no' to trust any cert and the path to a CA-bundle") parser.add_argument("--debug-logging", help="turn on debug logging", action="store_true") parser.add_argument("--calendar-url", help="URL for calendar to be used (may be absolute or relative to caldav URL, or just the name of the calendar)") + parser.add_argument("--ignoremethod", help="Ignores METHOD property if exists in the request. This violates RFC4791 but is sometimes appended by some calendar servers", action="store_true") ## TODO: check sys.argv[0] to find command ## TODO: set up logging |