fix variable

This commit is contained in:
Valentin CZERYBA 2023-04-01 00:11:33 +02:00
parent e0b4895b62
commit bcb3abce01

View File

@ -110,7 +110,7 @@ class WPimport:
for k in elements[i]: for k in elements[i]:
if k["name"] == j: if k["name"] == j:
element_exist = True element_exist = True
array = listelement[i].append(k["id"]) listelement[i].append(k["id"])
if element_exist is False: if element_exist is False:
data = {"name": j} data = {"name": j}
page = requests.post("http://{0}/wp-json/wp/v2/{1}".format(self.wordpress, i), auth=self.basic, data=data) 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} params = {"search":title}
page = requests.get("http://{0}/wp-json/wp/v2/posts".format(self.wordpress), auth=self.basic, params=params) page = requests.get("http://{0}/wp-json/wp/v2/posts".format(self.wordpress), auth=self.basic, params=params)
page_exist = True page_exist = True
if page.status_code: if page.status_code == 200:
result = page.json() result = page.json()
if len(result) == 0: if len(result) == 0:
page_exist = False page_exist = False