Skip to content

Commit

Permalink
Allow passing custom HTTP headers to DAVClient
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonSanDiego authored and tobixen committed Feb 23, 2023
1 parent 95d8b10 commit 25db457
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions caldav/davclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def __init__(
timeout=None,
ssl_verify_cert=True,
ssl_cert=None,
headers={},
):
"""
Sets up a HTTPConnection object towards the server in the url.
Expand Down Expand Up @@ -357,11 +358,12 @@ def __init__(
log.debug("init - proxy: %s" % (self.proxy))

# Build global headers
self.headers = {
self.headers = headers
self.headers.update({
"User-Agent": "Mozilla/5.0",
"Content-Type": "text/xml",
"Accept": "text/xml, text/calendar",
}
})
if self.url.username is not None:
username = unquote(self.url.username)
password = unquote(self.url.password)
Expand Down

0 comments on commit 25db457

Please sign in to comment.