【问题标题】:getting ConnectionError: ('Connection aborted.', BadStatusLine('No status line received - the server has closed the connection',)) on python在 python 上获取 ConnectionError: ('Connection aborted.', BadStatusLine('No status line received - 服务器已关闭连接',))
【发布时间】:2020-09-07 03:37:37
【问题描述】:

我正在尝试使用我在 python 中使用 pip 安装的 wikipidia 包从 wikipidia 获取数据。但是当我运行此代码时,它会出现此错误:

raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('No status line    received - the server has closed the connection',))

这是我的代码:

import wikipedia
print(wikipedia.summary('albert einstien',sentences= 3))

我尝试将 wikipedia.API_URL 设置为 https 而不是 http。我的代码在 repl.it(在线编码平台)上运行良好,但是当我在我的电脑上运行时出现此错误

【问题讨论】:

  • 使用“阿尔伯特·爱因斯坦”有什么不同吗?

标签: python https python-requests connection wikipedia


【解决方案1】:

这对我来说似乎是网络错误 - 我建议确保您可以从浏览器访问 Wikipedia 的 API。如果可行,请尝试使用确切的页面标题,即。 “阿尔伯特·爱因斯坦”就你而言。

【讨论】:

    猜你喜欢
    • 2018-11-18
    • 1970-01-01
    • 2016-01-15
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-29
    • 1970-01-01
    相关资源
    最近更新 更多