Why does the "sections" property in Python wikipedia package return an empty list?

Viewed 507

I can get content of a Wikipedia section if I ask for a specific section, for example:

import wikipedia
print(wikipedia.WikipediaPage('Sleep Well Beast').section("Promotion"))

but when I try to get all the sections, I get an empty list, why?

print(wikipedia.WikipediaPage('Sleep Well Beast').sections)

According to documentation, this should give a list of sections:

https://wikipedia.readthedocs.io/en/latest/code.html#api

1 Answers

You need to install the wikipedia_sections libary using

pip install wikipedia_sections
Related