Я пробую WordPress API
Ubuntu, Python3 .6
Создание страницы не вызывает проблем:
import xmlrpc.client
import datetime
wp_url = "blogaddress.com/xmlrpc.php"
wp_username = "user"
wp_password = "pass*"
wp_blogid = ""
status_draft = 0
status_published = 1
server = xmlrpc.client.ServerProxy(wp_url)
title = 'title'
content = 'This is a test'
date_created = xmlrpc.client.DateTime(datetime.datetime.strptime("2011-10-20 21:08", "%Y-%m-%d %H:%M"))
categories = ["Beginner Tutorial"]
tags = []
data = {'description': content, 'dateCreated': date_created, 'categories': categories,
'mt_keywords': tags}
post_id = server.wp.newPage(wp_blogid, wp_username, wp_password, data, status_published)
Когда я пытаюсь использовать editPage
:
data = {"id":244,"content":"This is a test"}
server.wp.editPage(wp_username, wp_password, data)
Я получаю следующую ошибку:
Traceback (последний вызов был последним): файл "/usr/local/lib/python3.6 /dist-packages/IPython/core/interactiveshell.py ", строка 3291, в run_code exe c (code_obj, файл self.user_global_ns, self.user_ns)" ", строка 1, в post_id = server.wp.editPage ( wp_blogid, wp_username, wp_password, data, status_published) Файл "/usr/lib/python3.6/xmlrpc/client.py", строка 1112, в вызов , возврат к себе .__ send (self .__ name, args) Файл "/usr/lib/python3.6/xmlrpc/client.py", строка 1452, в __request verbose = self .__ verbose File "/usr/lib/python3.6/xmlrpc/client.py ", строка 1154, в запросе возвращает файл self.single_request (host, handler, request_body, verbose) Файл" /usr/lib/python3.6/xmlrpc/client.py ", строка 1170, в single_request возвращает self.parse_response ( соответственно) Файл "/usr/lib/python3.6/xmlrpc/clien t.py ", строка 1342, в parse_response возвращает файл u.close ()" /usr/lib/python3.6/xmlrpc/client.py ", строка 656, ошибка близкого повышения (** self._stack [ 0]) xmlrp c .client.Fault:
Я не могу понять, что здесь не так и правильно ли я отправляю editPage
?