wawbus.api package

Submodules

wawbus.api.exceptions module

exception wawbus.api.exceptions.ZtmApiException(msg: str)

Bases: Exception

msg: str
exception wawbus.api.exceptions.ZtmHttpException(error: RequestException)

Bases: ZtmApiException

Module contents

class wawbus.api.ZtmApi(api_key: str, retry_count: int = 3)

Bases: object

api_key: str
get_bus_positions() List[dict]

Get bus positions

Returns:

Lat, Lon, Time, Lines, VehicleNumber, Brigade

Return type:

a list of dicts with keys

get_routes() List[dict]

Get bus routes

Returns:

odleglosc, ulica_id, nr_zespolu, typ, nr_przystanku, bus, direction, stop

Return type:

a list of dicts with keys

get_stop_locations() List[dict]

Get bus stop locations

Returns:

id, name, lat, lon

Return type:

a list of dicts with keys

get_timetable(stop_id: str, line: str, stop_nr: str) List[dict]

Get bus timetable

Parameters:
  • stop_id (str) – bus stop id (from get_stop_locations)

  • line (str) – bus line number

  • stop_nr (str) – bus stop number

Returns:

symbol_2, symbol_1, brygada, kierunek, trasa, czas

Return type:

a list of dicts with keys

req(endpoint: str, rid: str | None = None, **qparams)

Request method with retries

Parameters:
  • endpoint – which endpoint to use

  • rid – resource id

  • qparams – other query parameters

Returns:

response from ZTM API

retry_count: int = 3