简体   繁体   English

用xmlrpc lib发布的Wordpress发布状态

[英]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.

相关问题 使用Python创建一个新的wordpress帖子(xmlrpc或wordpress_xmlrpc) - Create a new wordpress post using Python (xmlrpc or wordpress_xmlrpc) 如何获取上一篇文章的URL,我刚刚使用xmlrpc发布了 - How to get the url of the last post, i just published using xmlrpc Python-python-wordpress-xmlrpc将标签添加到具有已知ID的帖子中 - Python - python-wordpress-xmlrpc add tags to a post with known id 使用 Python-xmlrpc 从外部图像链接设置 Wordpress 帖子缩略图 - Set Wordpress Post Thumbnail from External image link using Python-xmlrpc 与Wordpress的xmlrpc库python会面 - Meeting with wordpress' xmlrpc library python 表示XMLRPC中退出状态和实际结果的约定 - convention to represent the exit status and actual result in XMLRPC Wordpress xmlrpc SSL证书错误(仅在一台计算机上) - Wordpress xmlrpc SSL Certificate Error (Only On 1 Machine) Python Wordpress_XMLRPC NewComment身份验证 - Python Wordpress_XMLRPC NewComment Auth 使用Python和Wordpress的XMLRPC的SSL问题 - SSL issue with XMLRPC using Python and Wordpress 我无法通过 wordpress_xmlrpc 从 python 发布到我的 wordpress 网站我得到 ExpatError: not well-formed (invalid token): line 1, column 222 - i can't post from python to my wordpress site by wordpress_xmlrpc i get ExpatError: not well-formed (invalid token): line 1, column 222
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM