From 548beced37aa3ddb01204e959883dfd40299b606 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Mon, 16 Aug 2021 21:35:29 +0200 Subject: [PATCH] Simplify some response decoding --- vdirsyncer/http.py | 2 +- vdirsyncer/storage/dav.py | 4 +--- vdirsyncer/storage/http.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/vdirsyncer/http.py b/vdirsyncer/http.py index 979d7fc7..add0f705 100644 --- a/vdirsyncer/http.py +++ b/vdirsyncer/http.py @@ -159,7 +159,7 @@ async def request( logger.debug(r.status) logger.debug(r.headers) - logger.debug(r.content) + logger.debug(r.text) if r.status == 412: raise exceptions.PreconditionFailed(r.reason) diff --git a/vdirsyncer/storage/dav.py b/vdirsyncer/storage/dav.py index fda9446e..79834d71 100644 --- a/vdirsyncer/storage/dav.py +++ b/vdirsyncer/storage/dav.py @@ -546,9 +546,7 @@ async def get_multi(self, hrefs): response = await self.session.request( "REPORT", "", data=data, headers=self.session.get_default_headers() ) - root = _parse_xml( - await response.content.read() - ) # etree only can handle bytes + root = _parse_xml(await response.content.read()) rv = [] hrefs_left = set(hrefs) for href, etag, prop in self._parse_prop_responses(root): diff --git a/vdirsyncer/storage/http.py b/vdirsyncer/storage/http.py index 4e3fc790..78f31fe6 100644 --- a/vdirsyncer/storage/http.py +++ b/vdirsyncer/storage/http.py @@ -74,7 +74,7 @@ async def list(self): ) self._items = {} - for item in split_collection((await r.read()).decode("utf-8")): + for item in split_collection(await r.text()): item = Item(item) if self._ignore_uids: item = item.with_uid(item.hash)