Skip to content

betting_combat.providers.ufccom.client

client.py — UFC.com’s athlete pages (/athlete/{slug}), read the way the fight-level research read them (data/ufc/fight_level/f01_pull_ufccom.py, f02_parse_ufccom.py), on the standard library only.

slug a name as UFC.com slugs it (lowercase words joined by '-'; namesakes '-0', '-1', …)
parse_page one page's fields (``Profile``'s, the read time and our id aside) and its Q&A
page_dates the page's Octagon debut and every date it lists beside a UFC fight
is_him 'debut' | 'fight date' | None: the page is the fighter of our bouts (his debut
within a day of his first, or a listed fight on one of his bout dates)
UfcCom the provider: ``athlete(slug)`` the page (None: an unknown slug, UFC.com's
search page), one request every 15 s (robots.txt's crawl-delay)

A count missing on the page is None, never 0: an old page’s 0-0-0 record means ‘not given’.

Classes

UfcCom

Bases: Provider

UFC.com’s athlete pages, one request every CRAWL_DELAY_S.

athlete

athlete(s: str) -> str | None

The page at /athlete/{s}; None when UFC.com does not know the slug (it answers with its search page).

Functions

is_him

is_him(page: str, first: dt.date, dates: set[dt.date]) -> str | None

‘debut’ when the page’s Octagon debut is within a day of first (his first bout of ours), ‘fight date’ when a fight it lists falls within a day of one of dates, else None.

page_dates

page_dates(page: str) -> tuple[dt.date | None, set[dt.date]]

The page’s Octagon debut, and every date it shows beside a UFC fight.

parse_page

parse_page(page: str) -> tuple[dict[str, Any], dict[str, str]]

(the fields, the Q&A as question -> answer) of one athlete page, as f02 parsed it.

slug

slug(name: str) -> str