summaryrefslogtreecommitdiffstats
path: root/contrib/caldav/calcurse-caldav.py
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-01-25 19:36:27 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-01-25 19:58:41 +0100
commit849459c63f6f55e8bb72e6938d47ec0cdf6f8171 (patch)
treec09e6adf2b10d47a0c5a765dba10d36cf69c6257 /contrib/caldav/calcurse-caldav.py
parent475c3416862703748525c816a2b0df82386cca0c (diff)
downloadcalcurse-849459c63f6f55e8bb72e6938d47ec0cdf6f8171.tar.gz
calcurse-849459c63f6f55e8bb72e6938d47ec0cdf6f8171.zip
calcurse-caldav: Support custom HTTP headers
Add support for specifying additional HTTP headers, such as the User-Agent, in the configuration file. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'contrib/caldav/calcurse-caldav.py')
-rwxr-xr-xcontrib/caldav/calcurse-caldav.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py
index 909d27b..841a63a 100755
--- a/contrib/caldav/calcurse-caldav.py
+++ b/contrib/caldav/calcurse-caldav.py
@@ -83,7 +83,8 @@ def get_auth_headers():
return headers
def remote_query(cmd, path, additional_headers, body):
- headers = get_auth_headers()
+ headers = custom_headers.copy()
+ headers.update(get_auth_headers())
if cmd == 'PUT':
headers['Content-Type'] = 'text/calendar; charset=utf-8'
else:
@@ -380,6 +381,11 @@ if config.has_option('Auth', 'Password'):
else:
password = None
+if config.has_section('CustomHeaders'):
+ custom_headers = dict(config.items('CustomHeaders'))
+else:
+ custom_headers = {}
+
# Show disclaimer when performing a dry run.
if dry_run:
print('Dry run. Nothing is actually imported/exported.')