Skip to content

Instantly share code, notes, and snippets.

@DxDiagDx
Created May 3, 2021
Embed
What would you like to do?
WordPress + Python: удалить пост
import requests
import base64
url = "https://wholeblogs.com/wp-json/wp/v2/posts/"
postID = '1'
user = "your-username"
password = "your-application-password"
credentials = user + ':' + password
token = base64.b64encode(credentials.encode())
header = {'Authorization': 'Basic ' + token.decode('utf-8')}
responce = requests.delete(url + postID, headers=header)
print(responce)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment