betty.wiki.client module#

Interact with the Wikipedia Query API.

class betty.wiki.client.Client#

Bases: object

Fetch information from the Wikipedia Query API.

__init__(*, download_directory: Path, http_client: ClientSession, user: User)#
async get_image(page_language: str, page_name: str) Image | None#

Get an image for a page.

async get_place_coordinates(page_language: str, page_name: str) Point | None#

Get the coordinates for a page that is a place.

async get_summary(page_language: str, page_name: str) Summary#

Get a summary for a page.

async get_translations(page_language: str, page_name: str) Mapping[str, str]#

Get the available translations for a page.

exception betty.wiki.client.ClientError#

Bases: HumanFacingException, RuntimeError

A client error.

final class betty.wiki.client.Image#

Bases: object

An image from Wikimedia Commons.

__init__(path: Path, media_type: MediaType, title: str, wikimedia_commons_url: str, name: str) None#
media_type: MediaType#
name: str#
path: Path#
title: str#
wikimedia_commons_url: str#
final class betty.wiki.client.Summary#

Bases: object

A Wikipedia page summary.

__init__(language: str, name: str, title: str, content: str) None#
content: str#
language: str#
name: str#
title: str#
property url: str#

The URL to the web page.