From c275f10fb08c8050a5f16efe01e1736d45006159 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Fri, 15 Sep 2023 23:38:35 +0200 Subject: [PATCH] test ok for featured media --- lib/WPImport.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/WPImport.py b/lib/WPImport.py index 5ad9416..118c102 100644 --- a/lib/WPImport.py +++ b/lib/WPImport.py @@ -464,12 +464,13 @@ class WPimport: try: page = self._request.get(img_src.replace("_q", "")) if page.status_code == 200: - self._logger.info("{0} : Get image for media featured : {1}".format(self._name, r.json()["title"]["raw"])) - self._addOrUpdateMedia(img_src.replace("_q", ""), page.content) - self._addOrUpdateFeaturedMedia(soup) + self._logger.info("{0} : Get image for media featured : {1}".format(self._name, img_src.replace("_q", ""))) + media = self._addOrUpdateMedia(img_src.replace("_q", ""), page) + if media["id"] != "": + self._addOrUpdateFeaturedMedia(soup) else: self._logger.error("{0} : Connection error with status code for get image for featured media : {1}".format(self._name, page.status_code)) - self._logger.debug("{0} : {1}".format(self._name, r.content)) + self._logger.debug("{0} : {1}".format(self._name, page.content)) except ConnectionError as err: self._logger.error("{0} : Connection error for get to image for featured media : {1}".format(self._name, err)) exit(1)