I attempt to publish a post to WordPress blog with python demands and rest programming interface by the following code:
auth = 'Basic ' + str(base64.b64encode(b'admin:123456'), 'utf-8')
headers = {'Authorization': auth}
body = {'title': 'Hello World'}
r = requests.post('wp-json/wp/v2/posts', headers=headers, data=body)
and I consistently got 401 error:
>>> r.text
'{"code":"rest_cannot_create","message":"Sorry, you are not allowed to create posts as this user.","data":{"status":401}}'
I'm almost certain that the account administrator and password are right and have an overseer role, Did I miss anything?