Reference¶
trivial.console¶
Script for managing the command line interface.
trivial.wikipedia¶
Wikipedia REST API client.
-
class
trivial.wikipedia.Page(title, extract)¶ Represents a Wikipedia page overview.
-
title¶ the title of the page.
-
extract¶ a summary of the page’s contents.
-
-
trivial.wikipedia.random_page(language='en')¶ Get the contents of a random Wikipedia page.
Queries the /page/random/summary endpoint of the Wikipedia REST API.
- Parameters
language (
str) – the Wikipedia language domain to use.- Return type
- Returns
a Page representing a random Wikipedia article.
- Raises
ClickException – The query failed, or received an invalid response.
Example
>>> from hypermodern_python import wikipedia >>> page = wikipedia.random_page(language="en") >>> bool(page.title) True