跳至內容
tdx-tw
使用指南

自行車

查詢公共自行車站、即時數量與自行車道。

bike_station() 以站點 UID 取得一個租借站與即時數量,查無站點時為 None:

status = client.bike_station("Taipei", "TPE500101001")
if status and status.availability:
    print(status.station.name, status.availability.available_to_rent)

批次查詢縣市的租借站、即時數量與自行車道:

for station in client.bike.stations("Taipei"):
    print(station.uid, station.name, station.capacity, station.position)

for live in client.bike.availability("Taipei"):
    print(live.uid, live.available_to_rent, live.available_to_return)

for lane in client.bike.cycling_routes("Taipei"):
    print(lane)

rental_counts 將可借車輛分為一般自行車與電動輔助車。所有參數與欄位見自行車 API。