Loading, please wait..
Posting Content Using WordPress Python username = “studiomenin"
password = ""

creds = username + ':' + password
cred_token = base64.b64encode(creds.encode())

header = {'Authorization': 'Basic ' + cred_token.decode('utf-8')}

url = "http://localhost/wordpress/wp-json/wp/v2"

post = {
 'title' : 'This is WordPress Python Integration Testing',

 'content' : 'Hello, this content is published using WordPress Python Integration',
 'status' : 'publish', 
 'categories': 5, 
 'date' : '2021-12-05T11:00:00'
}

blog = requests.post(url + '/posts' , headers=header , json=post)
print(blog)

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *