我正在尝试使用模块 python-wordpress-xmlrpc 来编辑我的帖子标题。但最后一行出错。不知道“EditPost”的用法。有人可以举例解释吗?
#find allpost 'movie'
allpost = client.call(posts.GetPosts({'post_type':'movie'}))
#find post title 'Bumblebee' n change 'Bumblebee 2018'
for post in allpost:
if post.title =='Bumblebee':
post.title = 'Bumblebee 2018'
client.call(posts.EditPost(post.id, post))
错误:
Traceback (most recent call last):
File "D:\Movie Website\remote upload\post.py", line 28, in <module>
wp.call(EditPost(post.id,post))
File "C:\Python27\lib\site-packages\wordpress_xmlrpc\base.py", line 37,
in call
raw_result = server_method(*args)
File "C:\Python27\lib\xmlrpclib.py", line 1243, in __call__
return self.__send(self.__name, args)
File "C:\Python27\lib\xmlrpclib.py", line 1602, in __request
verbose=self.__verbose
File "C:\Python27\lib\xmlrpclib.py", line 1283, in request
return self.single_request(host, handler, request_body, verbose)
File "C:\Python27\lib\xmlrpclib.py", line 1316, in single_request
return self.parse_response(response)
File "C:\Python27\lib\xmlrpclib.py", line 1493, in parse_response
return u.close()
File "C:\Python27\lib\xmlrpclib.py", line 800, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 404: 'Invalid attachment ID.'>