insert #6

Merged
v4l3n71n merged 60 commits from insert into master 2023-04-11 21:29:54 +00:00
Showing only changes of commit f77274f00e - Show all commits

View File

@ -44,8 +44,9 @@ class WPimport:
page = requests.get(img_src)
if page.status_code == 200:
media=self._addOrUpdateMedia(img_src, page)
headers = {'Content-Type': 'application/json', 'Accept':'application/json'}
data = {"featured_media": media["id"]}
r = requests.post("http://{0}/wp-json/wp/v2/posts/{1}".format(self._wordpress, result[0]["id"]), auth=self._basic, data=json.dumps(data))
r = requests.post("http://{0}/wp-json/wp/v2/posts/{1}".format(self._wordpress, result[0]["id"]), auth=self._basic, headers=headers, data=json.dumps(data))
if r.status_code == 200:
print("Ajout media featured : {0}".format(r.json()["title"]["raw"]))