betty.wikipedia.client module

Interact with the Wikipedia Query API.

class betty.wikipedia.client.Client[source]

Bases: object

Fetch information from the Wikipedia Query API.

This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.

__init__(fetcher: Fetcher, rate_limiter: RateLimiter)[source]
async get_image(page_language: str, page_name: str) Image | None[source]

Get an image for a page.

async get_place_coordinates(page_language: str, page_name: str) Point | None[source]

Get the coordinates for a page that is a place.

async get_summary(page_language: str, page_name: str) Summary | None[source]

Get a summary for a page.

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

Get the available translations for a page.

final class betty.wikipedia.client.Image[source]

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.wikipedia.client.Summary[source]

Bases: object

A Wikipedia page summary.

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

The URL to the web page.