Skip to content

Commit 83251e2

Browse files
feat: Add schedule_for_route.py example
1 parent 68e0128 commit 83251e2

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

examples/schedule_for_route.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from helpers.load_env import load_settings
2+
3+
from onebusaway import OnebusawaySDK
4+
5+
# Load settings from .env file, if it exists. If not, we'll use the
6+
# Puget Sound server URL (which is also the default in the SDK) and
7+
# the 'TEST' API key.
8+
settings = load_settings(
9+
{
10+
"api_key": "TEST",
11+
"base_url": "https://api.pugetsound.onebusaway.org/",
12+
}
13+
)
14+
15+
# Create a new instance of the OneBusAway SDK with the settings we loaded.
16+
oba = OnebusawaySDK(**settings)
17+
18+
route_id = "1_100224"
19+
response = oba.schedule_for_route.retrieve(route_id)
20+
if response and response.data:
21+
print(response.data.entry.stop_trip_groupings[0])

0 commit comments

Comments
 (0)