parent comment 90%

This commit is contained in:
Valentin CZERYBA 2023-04-16 21:25:32 +02:00
parent 581b6941a6
commit 4cf301b216

View File

@ -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: