From bcb3abce016e4f038c499ccd3170cc792e0135f1 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sat, 1 Apr 2023 00:11:33 +0200 Subject: [PATCH] fix variable --- insert_wordpress.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/insert_wordpress.py b/insert_wordpress.py index 0f1b2fa..854c412 100644 --- a/insert_wordpress.py +++ b/insert_wordpress.py @@ -110,7 +110,7 @@ class WPimport: for k in elements[i]: if k["name"] == j: element_exist = True - array = listelement[i].append(k["id"]) + listelement[i].append(k["id"]) if element_exist is False: data = {"name": j} page = requests.post("http://{0}/wp-json/wp/v2/{1}".format(self.wordpress, i), auth=self.basic, data=data) @@ -145,7 +145,7 @@ class WPimport: params = {"search":title} page = requests.get("http://{0}/wp-json/wp/v2/posts".format(self.wordpress), auth=self.basic, params=params) page_exist = True - if page.status_code: + if page.status_code == 200: result = page.json() if len(result) == 0: page_exist = False