diff --git a/lib/WPImport.py b/lib/WPImport.py index 4760aa5..47db168 100644 --- a/lib/WPImport.py +++ b/lib/WPImport.py @@ -215,6 +215,18 @@ class WPimport: if page.status_code == 200: self._logger.info("Commentaire mise à jour pour {0}".format(title)) else: + if i["parent_id"] != -1: + parent_id = int(i["parent_id"]) + try: + page = self._request.get("http://{0}/wp-json/wp/v2/comments".format(self._wordpress), auth=self._basic, params=params) + except Exception as err: + self._logger.error("Connection error : {0}".format(err)) + exit(1) + if page.status_code == 200: + result = page.json() + for j in result: + if comment[parent_id]["author"] == j["author_name"] and comment[parent_id]["date"] == j["date"]: + data["parent"]=j["id"] try: page = self._request.post("http://{0}/wp-json/wp/v2/comments".format(self._wordpress), auth=self._basic, data=data) except Exception as err: