diff --git a/insert_wordpress.py b/insert_wordpress.py index 9e40faa..0f1b2fa 100644 --- a/insert_wordpress.py +++ b/insert_wordpress.py @@ -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"])) +