From c1d12a42f700a1853220f2ff74963fafd0f75cf9 Mon Sep 17 00:00:00 2001 From: Hidde van der Heide Date: Thu, 21 Jan 2021 11:41:40 +0100 Subject: [PATCH] Added ignore_missing_href option to skip objects the remote fails to provide --- vdirsyncer/storage/dav.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vdirsyncer/storage/dav.py b/vdirsyncer/storage/dav.py index 2c02ae3f..1be788c4 100644 --- a/vdirsyncer/storage/dav.py +++ b/vdirsyncer/storage/dav.py @@ -367,7 +367,7 @@ def init_and_remaining_args(cls, **kwargs): def __init__(self, url, username='', password='', verify=True, auth=None, useragent=USERAGENT, verify_fingerprint=None, - auth_cert=None): + auth_cert=None, ignore_missing_href=False): self._settings = { 'cert': prepare_client_cert(auth_cert), 'auth': prepare_auth(auth, username, password) @@ -376,6 +376,7 @@ def __init__(self, url, username='', password='', verify=True, auth=None, self.useragent = useragent self.url = url.rstrip('/') + '/' + self.ignore_missing_href = ignore_missing_href self._session = requests.session() @@ -504,7 +505,8 @@ def get_multi(self, hrefs): else: rv.append((href, Item(raw), etag)) for href in hrefs_left: - raise exceptions.NotFoundError(href) + if not self.session.ignore_missing_href: + raise exceptions.NotFoundError(href) return rv def _put(self, href, item, etag):