How to Create an Application Password for WordPress API?
How to Create an Application Password for WordPress API?
I want to make posts to my blog by using the Wordpress API. In order to authenticate my requests, I understand that I have to create a username and password for my private app.
This video tries to explain how to create an application password. https://www.youtube.com/watch?v=bsz6hb1EUMY
The problem is, the UI has changed since that video was made. After opening the Users tab, no option appears to create an application.
So, how can I create a new app to give it a username and password so I can authenticate my API calls?
import requests, json
from google.colab import userdata
url = f'http://{SITE_NAME}.wordpress.com/wp-json/wp/v2/posts'
username = userdata.get('WORDPRESS_USERNAME')
password = userdata.get('WORDPRESS_PASSWORD')
print(username)
print(password)
headers = {'Accept': 'application/json'}
params = {'status': 'publish'}
response = requests.get(url,
auth=(username, password),
headers=headers,
params=params)
# process response
response_code = response.status_code
print(response_code)
is_response_404 = response_code == 404
if is_response_404:
print("Oops")
else:
# Decode the JSON response
response_text = response.text
print(response_text)
data = json.loads(response_text)
print(data)
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand