parent-comment #8

Merged
v4l3n71n merged 16 commits from parent-comment into master 2023-04-20 19:30:46 +00:00
Showing only changes of commit 4cf301b216 - Show all commits

View File

@ -215,6 +215,18 @@ class WPimport:
if page.status_code == 200: if page.status_code == 200:
self._logger.info("Commentaire mise à jour pour {0}".format(title)) self._logger.info("Commentaire mise à jour pour {0}".format(title))
else: 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: try:
page = self._request.post("http://{0}/wp-json/wp/v2/comments".format(self._wordpress), auth=self._basic, data=data) page = self._request.post("http://{0}/wp-json/wp/v2/comments".format(self._wordpress), auth=self._basic, data=data)
except Exception as err: except Exception as err: