school_scraper.fsdscraper module

Scraper for New Brunswick francophone school district website

class school_scraper.fsdscraper.FSDScraper(html)[source]

Bases: object

Interface for parsing HTML data loaded from the New Brunswick francophone school district website

Parameters

html (str) – HTML data loaded from the website. Is expected to contain a single HTML table containing rows describing each school in each school district

SCHEDULE_URL = 'https://bp.nbed.nb.ca/notices/BPRFtbl.aspx?dst=dsfs&vtbl=1'
property district_names

list of names of all districts parsed from the HTML

Type

list (str)

property districts

0 or more districts parsed from the HTML content

Type

list (FSDDistrict)

get_district(name)[source]

Gets a specific district from the HTML content

Parameters

name (str) – the name of the district to locate

Returns

Reference to the district details for the named district, or None if no district with the given name exists

Return type

FSDDistrict

property school_names

list of unique names of all schools in all districts

Type

list (str)

static validate(html)[source]

Checks to see if HTML loaded from the website is parseable

Parameters

html (str) – HTML data loaded from the district website

Returns

True if the HTML content was parseable, False if not. Details of any parsing errors are reported to the logger.

Return type

bool