Skip to content

Commit f54ca0a

Browse files
refactor: Update stop retrieval endpoint in StopResource and AsyncStopResource
1 parent e159da5 commit f54ca0a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

examples/stop.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
3+
import onebusaway
4+
5+
6+
def main_sync() -> None:
7+
client = onebusaway.OnebusawaySDK(api_key="TEST")
8+
stop = client.stop.retrieve("1_75403")
9+
10+
if stop.data and stop.data.entry:
11+
print(stop.data.entry)
12+
else:
13+
print("stop not found")
14+
15+
if __name__ == "__main__":
16+
main_sync()

src/onebusaway/resources/stop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def retrieve(
5454
if not stop_id:
5555
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
5656
return self._get(
57-
f"/api/where/stop/stopID.json",
57+
f"/api/where/stop/{stop_id}.json",
5858
options=make_request_options(
5959
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
6060
),
@@ -97,7 +97,7 @@ async def retrieve(
9797
if not stop_id:
9898
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
9999
return await self._get(
100-
f"/api/where/stop/stopID.json",
100+
f"/api/where/stop/{stop_id}.json",
101101
options=make_request_options(
102102
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
103103
),

0 commit comments

Comments
 (0)