Skip to content

Instantly share code, notes, and snippets.

Created May 3, 2021
What would you like to do?
WordPress + Python: создать пост
import requests
import base64
url = ""
user = "your-username"
password = "your-application-password"
credentials = user + ':' + password
token = base64.b64encode(credentials.encode())
header = {'Authorization': 'Basic ' + token.decode('utf-8')}
post = {
'title': 'Hello World',
'status': 'publish',
'content': 'This is my first post created using rest API',
'categories': 5, #category ID
'date': '2021-05-04T10:00:00'
responce = , headers=header, json=post)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment