我能解决这个问题
B.按照那里的帮助文本,为你的用户名创建密码字符串-假设它是mypassword123
现在在你的终端上做这个
"管理员:mypassword123“|基64
您将获得一个新的密码-例如pwdabc123
D.代码看起来像url_srcdest = "http://example.com/wp-json/wp/v2/pages/"
headers = {'Content-Type': 'application/json',
'Authorization': 'Basic pwdabc123',
'Username': '',
'Password':'pwdabc123'}
data = \
{
"title":"Testing via API via Python",
"content":"tEST CONTENT OF THE THIS TEST PAGE via PYTHON",
"status": "publish"
}
response = requests.post(url_srcdest, data=json.dumps(data), headers=headers)