Skip to content

Commit 68e0128

Browse files
feat: Add routes_ids_for_agency.py example
1 parent 95c7c8c commit 68e0128

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

examples/routes_ids_for_agency.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
agency_id = "40" # Link Light Rail in the Seattle area.
19+
20+
route_ids = oba.route_ids_for_agency.list(agency_id)
21+
if route_ids.data and route_ids.data.list:
22+
for route_id in route_ids.data.list:
23+
print(route_id)

0 commit comments

Comments
 (0)