association image article

This commit is contained in:
Valentin CZERYBA 2023-03-31 00:14:38 +02:00
parent 066d8cae52
commit e0b4895b62

View File

@ -162,6 +162,12 @@ class WPimport:
page = requests.post("http://{0}/wp-json/wp/v2/comments".format(self.wordpress), auth=self.basic, data=data)
if page.status_code == 201:
print("Commentaire ajoute pour {0}".format(result["title"]["raw"]))
for i in list_img:
data = {"post": result["id"]}
r = requests.post("http://{0}/wp-json/wp/v2/media/{1}".format(self.wordpress, i["id"]), auth=self.basic, data=data)
if r.status_code == 200:
print("Association d'une image à l'article {0}".format(result["title"]["raw"]))