[英]Wordpress post status published with xmlrpc lib
I'm trying to publish posts via xmlrpc lib with Python. 我正在尝试使用Python通过xmlrpc lib发布帖子。 The problem is in post status: it setted to "publish in future" but should to be "published".
问题出在发布状态:设置为“将来发布”,但应“发布”。 Here is a part of my code:
这是我的代码的一部分:
status_draft = 0
status_published = 1
server = xmlrpclib.ServerProxy(wp_url)
title = titles.encode("utf-8")
content = text.encode("utf-8")
date_created = xmlrpclib.DateTime(datetime.datetime.today())
categories = ["News"]
tags = []
data = {'title': title, 'description': content, 'dateCreated': date_created, 'categories': categories, 'mt_keywords': tags}
post_id = server.metaWeblog.newPost(wp_blogid, wp_username, wp_password, data, status_published)
WP version is 3.5.1, Python 2.7 WP版本为3.5.1,Python 2.7
How can I solve this problem ? 我怎么解决这个问题 ?
I find out that the prblem was truely in dateCreated. 我发现问题确实在dateCreated中。 The way to solve that issue is to set date_created time minus random time value.
解决该问题的方法是设置date_created时间减去随机时间值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.