OpenHolidaysClient#

class openstef_models.transforms.time_domain.school_holiday_features_adder.OpenHolidaysClient(*, school_holidays_url: str = 'https://openholidaysapi.org/SchoolHolidays', user_agent: str = 'openstef-school-holiday-features (+https://github.com/OpenSTEF/openstef)', timeout_seconds: float = 30, max_attempts: int = 2, retry_delay_seconds: float = 2)[source]

Bases: BaseConfig

Client for the OpenHolidays API school holidays endpoint.

Holds the endpoint and transport settings. Pass a different instance (or a subclass that overrides get_school_holidays) to SchoolHolidayFeatureAdder.client to change how holidays are retrieved.

Attribution: school holiday data from OpenHolidays API (openholidaysapi.org), licensed under ODbL 1.0.

Parameters:
  • school_holidays_url (str)

  • user_agent (str)

  • timeout_seconds (float)

  • max_attempts (int)

  • retry_delay_seconds (float)

school_holidays_url: str
user_agent: str
timeout_seconds: float
max_attempts: int
retry_delay_seconds: float
get_school_holidays(request: SchoolHolidaysRequest) → list[SchoolHolidayPeriod][source]

Retrieve school holiday periods that overlap the requested date range.

Makes one HTTP request. Connection errors and transient server responses (429, 5xx) are retried.

Parameters:

request (SchoolHolidaysRequest) – Query parameters for the endpoint.

Return type:

list[SchoolHolidayPeriod]

Returns:

School holiday periods that overlap the requested range.

Raises:

SchoolHolidayFetchError – If the API cannot be reached or returns an unexpected response.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': False, 'extra': 'ignore', 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].