Reference¶
modern_python_template.console¶
Command-line Interface for project.
modern_python_template.wikipedia¶
Client for the wikipedia REST API, version 1.
See API documentation.
- class modern_python_template.wikipedia.Page(title, extract)¶
Page Resource.
- title¶
The title of the wikipedia page.
- Type
str
- extract¶
A plain text summary.
- Type
str
- modern_python_template.wikipedia.random_page(language='en')¶
Return a random page.
Performs a GET request to the /page/random/summary endpoint.
- Parameters
language (
str) – The Wikipedia language edition. By default, the English Wikipedia is used (“en”).- Return type
- Returns
A page resource.
- Raises
ClickException – The HTTP request failed or the HTTP response contained an invalid body.
Example
>>> from hypermodern_python import wikipedia >>> page = wikipedia.random_page(language="en") >>> bool(page.title) True