使用python在wordpress上发布 [英] posting on wordpress using python
问题描述
这是我第一次尝试任何互联网应用程序.我正在尝试使用 python 从我 PC 中的文本文档在我的博客上发帖.我的代码在这里
It is my first attempt of any internet application. I am trying to post on my blog from a text document in my PC using python. My code is here
f = open('proofs.txt')
data = f.readline()
print data
import wordpresslib
url = 'http://www.agnsa.wordpress.com/xmlrpc.php'
wp = wordpresslib.WordPressClient(url,'agnsa','pan@13579')
wp.selectBlog(0)
post = wordpresslib.WordPressPost()
post.title = 'try'
post.description = data
idPost = wp.newPost(post,True)
运行该模块后,它给出了与服务器连接失败的错误.这是回应.我试图找到它,但我无法理解如何解决它.我以前从未开发过任何此类应用程序.这很简单,但我现在不明白该怎么做....谁能给我建议该怎么做??
After running the module it is giving the error that connection failed to server. Here is the response. I tried to find about it but i couldnt understand how i can solve it. I never develop any such application before. It is simple but i cant understand what to do now.... Can any one give me suggestion what to do ??
错误是:
[Errno 10060] A connection attempt failed because the connected party did
not properly respond after a period of time, or established connection failed
because connected host has failed to respond
推荐答案
一些帮助您排除故障的提示:
A few pointers to help you troubleshoot:
- 域 http://www.agnsa.wordpress.com/ 不存在.这是正确的吗?
- 在 wordpress 上,默认情况下不启用 XMLRPC.转到设置-> 写入-> 远程发布并选中您帐户上的 XML-RPC 框.有关 XML-RPC 支持的更多信息.
- 已编辑 XML RPC 在 wordpress 上的正确路径,因为您有一个域
agneesa.wordpress.com
将是http://agneesa.wordpress.com/wordpress/xmlrpc.php
.参见端点部分. - 您刚刚发布了密码吗?StackOverflow 有一个值得信赖和乐于助人的社区.但我不确定我会相信世界其他地方:)
- The domain http://www.agnsa.wordpress.com/ does not exist. Is this correct?
- On wordpress, XMLRPC is not turned on by default. Go to Settings->Writing->Remote Publishing and check the box for XML-RPC on your account. More info on XML-RPC Support.
- EDITED The correct path for XML RPC on wordpress, since you have a domain
agneesa.wordpress.com
would behttp://agneesa.wordpress.com/wordpress/xmlrpc.php
. See section on Endpoint. - Have you just published your password? StackOverflow has a trustworthy and helpful community. But I am not sure I would trust the rest of the world :)
如果您在服务器端启用了 XML-RPC 并且您注释中的地址正确,那么此代码应该可以工作:
If you have enable XML-RPC on the server side and the address in your comment is correct, then this code should work:
import wordpresslib
# dummy data to be on safe side
data = "Post content, just ensuring data is not empty"
url='http://agneesa.wordpress.com/wordpress/xmlrpc.php'
# insert correct username and password
wp=wordpresslib.WordPressClient(url,'agnsa','pan@13579')
wp.selectBlog(0)
post=wordpresslib.WordPressPost()
post.title='try'
post.description=data
idPost=wp.newPost(post,True)
最新的错误提示您无法建立连接.这要么是由于代码中的地址错误,要么是由于服务器端出现故障(由于某种原因不接受连接).在关于 SO 的其他问题中讨论了相同的错误,此处,此处 和此处 -- 虽然它们与您使用的图书馆无关,但浏览答案和相关问题可能有助于为您提供线索.
The latest error suggests you cannot make a connection. It is either due to the wrong address in your code, or due to a failure on the side of the server (not accepting the connection for some reason). The same error was discussed in other questions on SO, here, here, and here -- while they do not relate to the library you are using, browsing the answers and related questions may be helpful in giving you leads.
这篇关于使用python在wordpress上发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!