update post
This commit is contained in:
parent
bcb3abce01
commit
faa22f1438
@ -150,7 +150,14 @@ class WPimport:
|
|||||||
if len(result) == 0:
|
if len(result) == 0:
|
||||||
page_exist = False
|
page_exist = False
|
||||||
else:
|
else:
|
||||||
print("La page {0} existe deja".format(title))
|
print("La page {0} existe deja et mis à jour".format(title))
|
||||||
|
post_id = result[0]["id"]
|
||||||
|
page = requests.post("http://{0}/wp-json/wp/v2/posts/{1}".format(self.wordpress, post_id), auth=self.basic, data=data)
|
||||||
|
if page.status_code == 200:
|
||||||
|
result = page.json()
|
||||||
|
print("Article mis à jour : {0}".format(result["title"]["raw"]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if page_exist == False:
|
if page_exist == False:
|
||||||
page = requests.post("http://{0}/wp-json/wp/v2/posts".format(self.wordpress), auth=self.basic, data=data)
|
page = requests.post("http://{0}/wp-json/wp/v2/posts".format(self.wordpress), auth=self.basic, data=data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user