【问题标题】:JSONDecodeError when using wikipedia-api使用 wikipedia-api 时出现 JSONDecodeError
【发布时间】:2019-01-18 16:17:04
【问题描述】:

我正在尝试使用 Python wikipedia-api。我收到如下错误。

File "C:\Python37\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

我没有找到任何解决此错误的方法。

import wikipedia

page = wikipedia.page("google")#interpreter shows error for this line
print(page.summary)

我希望输出如下所示:

https://en.wikipedia.org/wiki/Google

【问题讨论】:

  • 它对我来说工作正常..这是你正在尝试的确切代码吗?
  • 是的。我尝试了许多与 wikipedia-api 相关的代码示例,但它们也不起作用。

标签: python json python-3.x wikipedia-api


【解决方案1】:

如果您所在国家/地区限制访问维基百科,这将导致错误。

您可以在计算机上使用 vpn 解决该错误。

【讨论】:

  • 感谢您的回答。我不这么认为。我想我们必须更改 url 请求。
猜你喜欢
  • 2018-12-13
  • 1970-01-01
  • 1970-01-01
  • 2021-01-20
  • 2018-04-25
  • 1970-01-01
  • 1970-01-01
  • 2022-01-02
  • 1970-01-01
相关资源
最近更新 更多