WordPress Api请求错误:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败(_ssl.c:700)

时间:2019-01-12 11:23:03

标签: python wordpress api ssl

我正在尝试通过以下网站的说明使用api发布请求和Python在WordPress中发布一些文本:WordPress APi

我的代码:

articleCategories=['Test1']
client = Client('https://wordpress.site.com/xmlrpc.php', 'username','password')
post = WordPressPost()
post.title = 'Test1'
post.content = 'This is a test'
post.terms_names = {'category':articleCategories}
post.post_status = 'publish'
client.call(NewPost(post))

运行时,出现以下错误:

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:700)

您能帮忙吗?

1 个答案:

答案 0 :(得分:0)

根据我对以下WooCommerce api的经验,解决此问题的最简单方法是在客户端URL中仅使用http://而不是https://。我想同样的解决方案可能适用于您正在使用的api。

您可能会考虑使用this WooCommerce api,您可能会发现它是最新的且更易于使用。