Skip to content

Commit 95c7c8c

Browse files
feat: Add routes_for_agency.py example
1 parent 0bf5951 commit 95c7c8c

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

examples/routes_for_agency.py

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

0 commit comments

Comments
 (0)