[英]Wordpress xmlrpc SSL Certificate Error (Only On 1 Machine)
I'm using the Wordpress xmlrpc Python module on Python 3.6 to automatically write and publish blog posts to my Wordpress site (hosted directly by Wordpress). 我正在Python 3.6上使用Wordpress xmlrpc Python模块自动将博客文章写入并发布到我的Wordpress网站(由Wordpress直接托管)中。
The program runs great on one of my Windows machines, but when I try to run it using my second Windows machine, with the exact same code, on the same network, I receive an SSL error. 该程序可以在我的一台Windows计算机上很好地运行,但是当我尝试在同一网络上使用第二台Windows计算机以完全相同的代码运行该程序时,会收到SSL错误。 Details below:
详情如下:
import ssl
import wordpress_xmlrpc
from wordpress_xmlrpc import Client
from wordpress_xmlrpc import WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts
from wordpress_xmlrpc.methods.posts import NewPost
from wordpress_xmlrpc.methods.users import GetUserInfo
from wordpress_xmlrpc.methods import posts
from wordpress_xmlrpc.compat import xmlrpc_client
wp = Client("https://website.io/xmlrpc.php", "wordpressusername", "wordpresspassword")
post = WordPressPost()
post.title = "title"
post.content = content
post.post_status = 'publish'
status_draft = 0
status_published = 1
wp.call(NewPost(post))
Here's the error: 这是错误:
File "C:\Python36\Lib\http\client.py", line 964, in send
self.connect()
File "C:\Python36\Lib\http\client.py", line 1400, in connect
server_hostname=server_hostname)
File "C:\Python36\Lib\ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "C:\Python36\Lib\ssl.py", line 808, in __init__
self.do_handshake()
File "C:\Python36\Lib\ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "C:\Python36\Lib\ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
I've used pip list
to view all installed modules on both machines and everything matches exactly. 我已经使用
pip list
来查看两台计算机上所有已安装的模块,并且一切都完全匹配。 The code is stored on a synced Google Drive folder, so it's literally the exact same .py file both times. 该代码存储在同步的Google云端硬盘文件夹中,因此实际上两次都是相同的.py文件。 I can't understand why it works on one machine but not the other.
我不明白为什么它可以在一台机器上运行而不能在另一台机器上运行。
I've read the thread here but I don't believe it applies to the wordpress xmlrpc tool. 我在这里阅读了该线程,但我认为它不适用于wordpress xmlrpc工具。 I've read through the documentation here but I can't see anything helpful.
我在这里阅读了文档,但没有任何帮助。
Is this something I have to tweak/delete/refresh the ssl certificates in Chrome or something? 这是我需要在Chrome中调整/删除/刷新ssl证书的东西吗? Any answers or insight much appreciated.
任何答案或见解非常感谢。 Thanks in advance
提前致谢
So, 3 weeks later, I finally found a way to fix this. 因此,三周后,我终于找到了解决此问题的方法。
I ended up completely uninstalling/deleting Python on my secondary machine and reinstalling everything (along with reinstalling all modules, and confirming via pip list
) and now it works (no more SSL error). 我最终在辅助计算机上完全卸载/删除Python并重新安装了所有内容(以及重新安装所有模块,并通过
pip list
确认),现在它可以正常工作了(不再有SSL错误)。
For what it's worth, and I can't be sure this is what was causing the issue in the first place, but previously, I was running Python 3.6.1 on the working machine and python 3.6.2 on the other, non-working machine. 为了它的价值,我不能确定这是首先导致问题的原因,但是以前,我在工作的机器上运行的是Python 3.6.1,而在另一台无法运行的机器上是python 3.6.2机。
When I reinstalled everything, I reinstalled Python 3.6.1 (to match the working machine) and it worked on both. 当我重新安装所有内容时,我重新安装了Python 3.6.1(以匹配工作机器),并且在两个版本上均可使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.