Skip to content

Building

Access building information from FIO.

Building

Bases: AbstractBuilding, AbstractEndpoint

get

get(building_ticker, timeout=None)

Gets a single building from FIO

Parameters:

Name Type Description Default
building_ticker str

Building Ticker (e.g., "CHP")

required
timeout float

Request timeout in seconds. Defaults to None.

None

Raises:

Type Description
BuildingTickerNotFound

Building Ticker was not found

Returns:

Name Type Description
BuildingTicker BuildingTicker

Building

Source code in fio_wrapper/endpoints/endpoints_v1/building.py
def get(
    self, building_ticker: str, timeout: Optional[float] = None
) -> BuildingTicker:
    """Gets a single building from FIO

    Args:
        building_ticker (str): Building Ticker (e.g., "CHP")
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Raises:
        BuildingTickerNotFound: Building Ticker was not found

    Returns:
        BuildingTicker: Building
    """
    (status, data) = self.adapter.get(
        endpoint=self.urls.building_get_url(building_ticker=building_ticker),
        err_codes=[204],
        timeout=timeout,
    )

    if status == 200:
        return BuildingTicker.model_validate(data)
    elif status == 204:
        raise BuildingTickerNotFound("Buildingticker not found")

all

all(timeout=None)

Gets all buildings from FIO

Parameters:

Name Type Description Default
timeout float

Request timeout in seconds. Defaults to None.

None

Returns:

Name Type Description
BuildingTickerList BuildingTickerList

List of Buildings as List[BuildingTicker]

Source code in fio_wrapper/endpoints/endpoints_v1/building.py
def all(self, timeout: Optional[float] = None) -> BuildingTickerList:
    """Gets all buildings from FIO

    Args:
        timeout (float, optional): Request timeout in seconds. Defaults to None.

    Returns:
        BuildingTickerList: List of Buildings as List[BuildingTicker]
    """
    (_, data) = self.adapter.get(
        endpoint=self.urls.building_get_all_url(), timeout=timeout
    )

    return BuildingTickerList.model_validate(data)