Created
May 3, 2021 21:37
-
-
Save DxDiagDx/b04e43dfa31e061528c2f076f0d92bea to your computer and use it in GitHub Desktop.
WordPress + Python: удалить пост
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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