Как мы можем добавить теги в сообщение WordPress, сделанное через rest api? - PullRequest
0 голосов
/ 01 августа 2020
• 1000 Хотя это на начальной стадии ..

см. Эту ссылку, чтобы узнать, о каком поле я говорю :: import запросы import json import base64

user = 'username'
pythonapp = 'G4kN hBNh r35J luXk aXyd n6Lm'
url = 'https://example.com/wp-json/wp/v2'

data_string = user + ':' + pythonapp

token = base64.b64encode(data_string.encode())

headers = {'Authorization': 'Basic ' + token.decode('utf-8')}

post = {'date': '2017-06-19T20:00:35',
        'title': 'First REST API post',
        'slug': 'rest-api-1',
        'status': 'publish',
        'content': 'this is the content post',
        'author': '1',
        'excerpt': 'Exceptional post!',
        'format': 'standard'
        }

r = requests.post(url + '/posts', headers=headers, json=post)

print('Your post is published on ' + json.loads(r.content.decode('utf-8'))['link']) `
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...