gpt4 book ai didi

python - 代理服务器上的 WordPress 和 Python

转载 作者:太空宇宙 更新时间:2023-11-03 19:17:49 28 4
gpt4 key购买 nike

这是在博客上发布的代码。这是我的第一次尝试。我不知道其中有什么错误。我正在使用代理服务器,收到的错误是与服务器的连接失败。

谁能帮帮我啊啊啊啊:/

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)

这里是回溯

这是回溯文件

   Traceback (most recent call last):
File "C:\Python27\Lib\example.py", line 34, in <module>
post.categories = (wp.getCategoryIdFromName('Python'),)
File "C:\Python27\Lib\wordpresslib.py", line 332, in getCategoryIdFromName
for c in self.getCategoryList():
File "C:\Python27\Lib\wordpresslib.py", line 321, in getCategoryList
self.user, self.password)
File "C:\Python27\Lib\xmlrpclib.py", line 1224, in __call__
return self.__send(self.__name, args)
File "C:\Python27\Lib\xmlrpclib.py", line 1578, in __request
verbose=self.__verbose
File "C:\Python27\Lib\xmlrpclib.py", line 1264, in request
return self.single_request(host, handler, request_body, verbose)
File "C:\Python27\Lib\xmlrpclib.py", line 1292, in single_request
self.send_content(h, request_body)
File "C:\Python27\Lib\xmlrpclib.py", line 1439, in send_content
connection.endheaders(request_body)
File "C:\Python27\Lib\httplib.py", line 954, in endheaders
self._send_output(message_body)
File "C:\Python27\Lib\httplib.py", line 814, in _send_output
self.send(msg)
File "C:\Python27\Lib\httplib.py", line 776, in send
self.connect()
File "C:\Python27\Lib\httplib.py", line 757, in connect
self.timeout, self.source_address)
File "socket.py", line 571, in create_connection
raise err

error: [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

最佳答案

从您网站的外观来看,您发布的网址返回 404(实际上并不存在)。但是,这似乎已准备好接收 POST 请求: http://agneesa.wordpress.com/xmlrpc.php

我建议您尝试检查该 URL 的准确性。

这是当我使用您的原始 URL 尝试您的代码时得到的结果:

xmlrpclib.ProtocolError: <ProtocolError for \
agneesa.wordpress.com/wordpress/xmlrpc.php: 404 Not Found>

这是我使用修改后的 URL 尝试时得到的结果:

wordpresslib.WordPressException: \
<WordPressException 403: 'Bad login/pass combination.'>

...显然是因为那不是您的真实帐户信息。简而言之,如果您的代理没有设置为正确转发请求,那么您的代理也可能会导致问题,但如果我们不知道您的代理配置的具体信息,就无法确定。

关于python - 代理服务器上的 WordPress 和 Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10767570/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com