python - 使用 wptools 时出现 SSL 证书问题

标签 python ssl wikipedia-api

在 Udacity 上的 Jupyter 上使用 wptools 时,我收到以下错误消息。

error: (60, 'SSL certificate problem: certificate has expired')


这是代码。
import wptools
page = wptools.page('E.T._the_Extra-Terrestrial').get()
当我运行时,我收到以下消息。
en.wikipedia.org (query) E.T._the_Extra-Terrestrial
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-2-5bef4afd1ab8> in <module>()
----> 1 page = wptools.page('E.T._the_Extra-Terrestrial').get()

/opt/conda/lib/python3.6/site-packages/wptools/page.py in get(self, show, proxy, timeout)
    459             self.flags['defer_imageinfo'] = True
    460 
--> 461             self.get_query(False, proxy, timeout)
    462             self.get_parse(False, proxy, timeout)
    463 

/opt/conda/lib/python3.6/site-packages/wptools/page.py in get_query(self, show, proxy, timeout)
    574             raise ValueError("get_query needs title or pageid")
    575 
--> 576         self._get('query', show, proxy, timeout)
    577 
    578         return self

/opt/conda/lib/python3.6/site-packages/wptools/core.py in _get(self, action, show, proxy, timeout)
     95         qstr = self._query(action, qobj)
     96         req = self._request(proxy, timeout)
---> 97         response = req.get(qstr, qobj.status)
     98 
     99         self.cache[action]['query'] = qstr

/opt/conda/lib/python3.6/site-packages/wptools/request.py in get(self, url, status)
     74             print("Requests DISABLED", file=sys.stderr)
     75         else:
---> 76             return self.curl_perform(crl)
     77 
     78     def curl_perform(self, crl):

/opt/conda/lib/python3.6/site-packages/wptools/request.py in curl_perform(self, crl)
     82         bfr = BytesIO()
     83         crl.setopt(crl.WRITEFUNCTION, bfr.write)
---> 84         crl.perform()
     85         info = curl_info(crl)
     86         if info:

error: (60, 'SSL certificate problem: certificate has expired')
我也无法在 Windows 10 上安装 wptools 以在本地对其进行测试,以检查 Udacity 的 Jupyter 是否有问题。

最佳答案

问题
请提供您在尝试下载时遇到的错误信息wptools在您的 Windows 10 上。
我在 Udacity 工作区遇到了类似的问题。后来我发现这个问题是截至 2022 年 6 月 14 日的,是 Udacity 上的一个技术问题,我知道它已经被报告并通知了技术团队。
我做了什么

  • 我从 Udacity 工作区
  • 下载了笔记本 (.ipynb)
  • 我上传了下载的.ipynb文件并在我的本地计算机(Windows)上打开它。
  • 我也遇到了错误,但错误是因为 wptools没有预装在 Anaconda 上。所以要做到这一点,我必须直接使用 pip 安装它,因为它是 here .

  • 在笔记本的第一个单元格上,您可以使用!pip install wptools
  • 安装后,您可以删除代码 !pip install wptools因此,您无需在运行该单元时重新安装它。

  • 我就是这样做的,它在我的 Windows 10 上运行良好。

    关于python - 使用 wptools 时出现 SSL 证书问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69696894/

    相关文章:

    python - 重命名 pandas.concat 的 DataFrame 输出上的列

    python - Scrapy:动态地将参数从命令行传递到管道

    python - 在 python luigi 上安排非常大量的工作

    python - 使用 Python 的 HTTPS 服务器

    php - Laravel 5.2 Socialite Facebook 登录 cURL 错误 60

    wikipedia-api - 如何使用维基百科 API 获取完整的图像评论?

    python - keras LSTM 应该在没有 input_shape 参数的情况下工作吗?

    MySQL 通过 SSH + Bash 错误

    wikipedia - 如何从维基百科页面中提取所有引用数据?

    regex - 查询页面并使用表格抓取它