Skip to content

Commit ba50d73

Browse files
committed
feat(api): update via SDK Studio
1 parent cfdc365 commit ba50d73

File tree

82 files changed

+1743
-863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1743
-863
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 5
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-4cacd27681586a8a15ad9de8f9611cdc0f6c59282aa780518d0864b38528d0c4.yml
1+
configured_endpoints: 6
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-27b1f9e5b37005e5040a5dd1be219f28a16f7e3a334e1b7919766b12fe34b33b.yml

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $ pip install -r requirements-dev.lock
3232
## Modifying/Adding code
3333

3434
Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
35-
`src/onebusaway/lib/` and `examples/` directories are exceptions and will never be overridden.
35+
`src/open_transit/lib/` and `examples/` directories are exceptions and will never be overridden.
3636

3737
## Adding and running examples
3838

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2024 One Bus Away
189+
Copyright 2024 Open Transit
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# One Bus Away Python API library
1+
# Open Transit Python API library
22

3-
[![PyPI version](https://img.shields.io/pypi/v/onebusaway.svg)](https://pypi.org/project/onebusaway/)
3+
[![PyPI version](https://img.shields.io/pypi/v/open-transit.svg)](https://pypi.org/project/open-transit/)
44

5-
The One Bus Away Python library provides convenient access to the One Bus Away REST API from any Python 3.7+
5+
The Open Transit Python library provides convenient access to the Open Transit REST API from any Python 3.7+
66
application. The library includes type definitions for all request params and response fields,
77
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
88

99
It is generated with [Stainless](https://www.stainlessapi.com/).
1010

1111
## Documentation
1212

13-
The REST API documentation can be found [on developer.onebusaway.org](https://developer.onebusaway.org). The full API of this library can be found in [api.md](api.md).
13+
The REST API documentation can be found [on docs.open-transit.com](https://docs.open-transit.com). The full API of this library can be found in [api.md](api.md).
1414

1515
## Installation
1616

@@ -20,23 +20,23 @@ pip install git+ssh://git@github.com/stainless-sdks/open-transit-python.git
2020
```
2121

2222
> [!NOTE]
23-
> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre onebusaway`
23+
> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre open-transit`
2424
2525
## Usage
2626

2727
The full API of this library can be found in [api.md](api.md).
2828

2929
```python
3030
import os
31-
from onebusaway import OneBusAway
31+
from open_transit import OpenTransit
3232

33-
client = OneBusAway(
33+
client = OpenTransit(
3434
# This is the default and can be omitted
3535
api_key=os.environ.get("OPEN_TRANSIT_API_KEY"),
3636
)
3737

38-
agencies_with_coverage_retrieve_response = client.agencies_with_coverage.retrieve()
39-
print(agencies_with_coverage_retrieve_response.code)
38+
config_retrieve_response = client.where.config.retrieve()
39+
print(config_retrieve_response.code)
4040
```
4141

4242
While you can provide an `api_key` keyword argument,
@@ -46,22 +46,22 @@ so that your API Key is not stored in source control.
4646

4747
## Async usage
4848

49-
Simply import `AsyncOneBusAway` instead of `OneBusAway` and use `await` with each API call:
49+
Simply import `AsyncOpenTransit` instead of `OpenTransit` and use `await` with each API call:
5050

5151
```python
5252
import os
5353
import asyncio
54-
from onebusaway import AsyncOneBusAway
54+
from open_transit import AsyncOpenTransit
5555

56-
client = AsyncOneBusAway(
56+
client = AsyncOpenTransit(
5757
# This is the default and can be omitted
5858
api_key=os.environ.get("OPEN_TRANSIT_API_KEY"),
5959
)
6060

6161

6262
async def main() -> None:
63-
agencies_with_coverage_retrieve_response = await client.agencies_with_coverage.retrieve()
64-
print(agencies_with_coverage_retrieve_response.code)
63+
config_retrieve_response = await client.where.config.retrieve()
64+
print(config_retrieve_response.code)
6565

6666

6767
asyncio.run(main())
@@ -80,27 +80,27 @@ Typed requests and responses provide autocomplete and documentation within your
8080

8181
## Handling errors
8282

83-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `onebusaway.APIConnectionError` is raised.
83+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `open_transit.APIConnectionError` is raised.
8484

8585
When the API returns a non-success status code (that is, 4xx or 5xx
86-
response), a subclass of `onebusaway.APIStatusError` is raised, containing `status_code` and `response` properties.
86+
response), a subclass of `open_transit.APIStatusError` is raised, containing `status_code` and `response` properties.
8787

88-
All errors inherit from `onebusaway.APIError`.
88+
All errors inherit from `open_transit.APIError`.
8989

9090
```python
91-
import onebusaway
92-
from onebusaway import OneBusAway
91+
import open_transit
92+
from open_transit import OpenTransit
9393

94-
client = OneBusAway()
94+
client = OpenTransit()
9595

9696
try:
97-
client.agencies_with_coverage.retrieve()
98-
except onebusaway.APIConnectionError as e:
97+
client.where.config.retrieve()
98+
except open_transit.APIConnectionError as e:
9999
print("The server could not be reached")
100100
print(e.__cause__) # an underlying Exception, likely raised within httpx.
101-
except onebusaway.RateLimitError as e:
101+
except open_transit.RateLimitError as e:
102102
print("A 429 status code was received; we should back off a bit.")
103-
except onebusaway.APIStatusError as e:
103+
except open_transit.APIStatusError as e:
104104
print("Another non-200-range status code was received")
105105
print(e.status_code)
106106
print(e.response)
@@ -128,16 +128,16 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
128128
You can use the `max_retries` option to configure or disable retry settings:
129129

130130
```python
131-
from onebusaway import OneBusAway
131+
from open_transit import OpenTransit
132132

133133
# Configure the default for all requests:
134-
client = OneBusAway(
134+
client = OpenTransit(
135135
# default is 2
136136
max_retries=0,
137137
)
138138

139139
# Or, configure per-request:
140-
client.with_options(max_retries=5).agencies_with_coverage.retrieve()
140+
client.with_options(max_retries=5).where.config.retrieve()
141141
```
142142

143143
### Timeouts
@@ -146,21 +146,21 @@ By default requests time out after 1 minute. You can configure this with a `time
146146
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
147147

148148
```python
149-
from onebusaway import OneBusAway
149+
from open_transit import OpenTransit
150150

151151
# Configure the default for all requests:
152-
client = OneBusAway(
152+
client = OpenTransit(
153153
# 20 seconds (default is 1 minute)
154154
timeout=20.0,
155155
)
156156

157157
# More granular control:
158-
client = OneBusAway(
158+
client = OpenTransit(
159159
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
160160
)
161161

162162
# Override per-request:
163-
client.with_options(timeout=5.0).agencies_with_coverage.retrieve()
163+
client.with_options(timeout=5.0).where.config.retrieve()
164164
```
165165

166166
On timeout, an `APITimeoutError` is thrown.
@@ -173,10 +173,10 @@ Note that requests that time out are [retried twice by default](#retries).
173173

174174
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
175175

176-
You can enable logging by setting the environment variable `ONE_BUS_AWAY_LOG` to `debug`.
176+
You can enable logging by setting the environment variable `OPEN_TRANSIT_LOG` to `debug`.
177177

178178
```shell
179-
$ export ONE_BUS_AWAY_LOG=debug
179+
$ export OPEN_TRANSIT_LOG=debug
180180
```
181181

182182
### How to tell whether `None` means `null` or missing
@@ -196,19 +196,19 @@ if response.my_field is None:
196196
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
197197

198198
```py
199-
from onebusaway import OneBusAway
199+
from open_transit import OpenTransit
200200

201-
client = OneBusAway()
202-
response = client.agencies_with_coverage.with_raw_response.retrieve()
201+
client = OpenTransit()
202+
response = client.where.config.with_raw_response.retrieve()
203203
print(response.headers.get('X-My-Header'))
204204

205-
agencies_with_coverage = response.parse() # get the object that `agencies_with_coverage.retrieve()` would have returned
206-
print(agencies_with_coverage.code)
205+
config = response.parse() # get the object that `where.config.retrieve()` would have returned
206+
print(config.code)
207207
```
208208

209-
These methods return an [`APIResponse`](https://github.com/stainless-sdks/open-transit-python/tree/main/src/onebusaway/_response.py) object.
209+
These methods return an [`APIResponse`](https://github.com/stainless-sdks/open-transit-python/tree/main/src/open_transit/_response.py) object.
210210

211-
The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/open-transit-python/tree/main/src/onebusaway/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
211+
The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/open-transit-python/tree/main/src/open_transit/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
212212

213213
#### `.with_streaming_response`
214214

@@ -217,7 +217,7 @@ The above interface eagerly reads the full response body when you make the reque
217217
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
218218

219219
```python
220-
with client.agencies_with_coverage.with_streaming_response.retrieve() as response:
220+
with client.where.config.with_streaming_response.retrieve() as response:
221221
print(response.headers.get("X-My-Header"))
222222

223223
for line in response.iter_lines():
@@ -270,10 +270,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
270270
- Additional [advanced](https://www.python-httpx.org/advanced/#client-instances) functionality
271271

272272
```python
273-
from onebusaway import OneBusAway, DefaultHttpxClient
273+
from open_transit import OpenTransit, DefaultHttpxClient
274274

275-
client = OneBusAway(
276-
# Or use the `ONE_BUS_AWAY_BASE_URL` env var
275+
client = OpenTransit(
276+
# Or use the `OPEN_TRANSIT_BASE_URL` env var
277277
base_url="http://my.test.server.example.com:8083",
278278
http_client=DefaultHttpxClient(
279279
proxies="http://my.test.proxy.example.com",

SECURITY.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
19-
or products provided by One Bus Away please follow the respective company's security reporting guidelines.
19+
or products provided by Open Transit please follow the respective company's security reporting guidelines.
2020

21-
### One Bus Away Terms and Policies
21+
### Open Transit Terms and Policies
2222

23-
Please contact info@onebusaway.org for any questions or concerns regarding security of our services.
23+
Please contact dev-feedback@open-transit.com for any questions or concerns regarding security of our services.
2424

2525
---
2626

api.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,75 @@
1-
# AgenciesWithCoverage
1+
# Where
2+
3+
## AgenciesWithCoverage
24

35
Types:
46

57
```python
6-
from onebusaway.types import AgenciesWithCoverageRetrieveResponse
8+
from open_transit.types.where import AgenciesWithCoverageListResponse
79
```
810

911
Methods:
1012

11-
- <code title="get /api/where/agencies-with-coverage.json">client.agencies_with_coverage.<a href="./src/onebusaway/resources/agencies_with_coverage.py">retrieve</a>() -> <a href="./src/onebusaway/types/agencies_with_coverage_retrieve_response.py">AgenciesWithCoverageRetrieveResponse</a></code>
13+
- <code title="get /api/where/agencies-with-coverage.json">client.where.agencies_with_coverage.<a href="./src/open_transit/resources/where/agencies_with_coverage.py">list</a>() -> <a href="./src/open_transit/types/where/agencies_with_coverage_list_response.py">AgenciesWithCoverageListResponse</a></code>
1214

13-
# Config
15+
## Config
1416

1517
Types:
1618

1719
```python
18-
from onebusaway.types import ConfigRetrieveResponse
20+
from open_transit.types.where import ConfigRetrieveResponse
1921
```
2022

2123
Methods:
2224

23-
- <code title="get /api/where/config.json">client.config.<a href="./src/onebusaway/resources/config.py">retrieve</a>() -> <a href="./src/onebusaway/types/config_retrieve_response.py">ConfigRetrieveResponse</a></code>
25+
- <code title="get /api/where/config.json">client.where.config.<a href="./src/open_transit/resources/where/config.py">retrieve</a>() -> <a href="./src/open_transit/types/where/config_retrieve_response.py">ConfigRetrieveResponse</a></code>
2426

25-
# CurrentTime
27+
## CurrentTime
2628

2729
Types:
2830

2931
```python
30-
from onebusaway.types import CurrentTimeRetrieveResponse
32+
from open_transit.types.where import CurrentTimeRetrieveResponse
3133
```
3234

3335
Methods:
3436

35-
- <code title="get /api/where/current-time.json">client.current_time.<a href="./src/onebusaway/resources/current_time.py">retrieve</a>() -> <a href="./src/onebusaway/types/current_time_retrieve_response.py">CurrentTimeRetrieveResponse</a></code>
37+
- <code title="get /api/where/current-time.json">client.where.current_time.<a href="./src/open_transit/resources/where/current_time.py">retrieve</a>() -> <a href="./src/open_transit/types/where/current_time_retrieve_response.py">CurrentTimeRetrieveResponse</a></code>
38+
39+
## StopsForLocation
40+
41+
Types:
42+
43+
```python
44+
from open_transit.types.where import StopsForLocationListResponse
45+
```
46+
47+
Methods:
48+
49+
- <code title="get /api/where/stops-for-location.json">client.where.stops_for_location.<a href="./src/open_transit/resources/where/stops_for_location.py">list</a>(\*\*<a href="src/open_transit/types/where/stops_for_location_list_params.py">params</a>) -> <a href="./src/open_transit/types/where/stops_for_location_list_response.py">StopsForLocationListResponse</a></code>
50+
51+
## Stop
3652

37-
# StopsForLocation
53+
### ArrivalAndDeparture
3854

3955
Types:
4056

4157
```python
42-
from onebusaway.types import StopsForLocationRetrieveResponse
58+
from open_transit.types.where.stop import ArrivalAndDepartureRetrieveResponse
4359
```
4460

4561
Methods:
4662

47-
- <code title="get /api/where/stops-for-location.json">client.stops_for_location.<a href="./src/onebusaway/resources/stops_for_location.py">retrieve</a>(\*\*<a href="src/onebusaway/types/stops_for_location_retrieve_params.py">params</a>) -> <a href="./src/onebusaway/types/stops_for_location_retrieve_response.py">StopsForLocationRetrieveResponse</a></code>
63+
- <code title="get /api/where/arrival-and-departure-for-stop/{stopID}.json">client.where.stop.arrival_and_departure.<a href="./src/open_transit/resources/where/stop/arrival_and_departure.py">retrieve</a>(stop_id, \*\*<a href="src/open_transit/types/where/stop/arrival_and_departure_retrieve_params.py">params</a>) -> <a href="./src/open_transit/types/where/stop/arrival_and_departure_retrieve_response.py">ArrivalAndDepartureRetrieveResponse</a></code>
4864

49-
# ArrivalsAndDeparturesForStop
65+
### ArrivalsAndDepartures
5066

5167
Types:
5268

5369
```python
54-
from onebusaway.types import ArrivalsAndDeparturesForStopRetrieveResponse
70+
from open_transit.types.where.stop import ArrivalsAndDepartureListResponse
5571
```
5672

5773
Methods:
5874

59-
- <code title="get /api/where/arrival-and-departure-for-stop/{stopID}.json">client.arrivals_and_departures_for_stop.<a href="./src/onebusaway/resources/arrivals_and_departures_for_stop.py">retrieve</a>(stop_id, \*\*<a href="src/onebusaway/types/arrivals_and_departures_for_stop_retrieve_params.py">params</a>) -> <a href="./src/onebusaway/types/arrivals_and_departures_for_stop_retrieve_response.py">ArrivalsAndDeparturesForStopRetrieveResponse</a></code>
75+
- <code title="get /api/where/arrivals-and-departures-for-stop/{stopID}.json">client.where.stop.arrivals_and_departures.<a href="./src/open_transit/resources/where/stop/arrivals_and_departures.py">list</a>(stop_id) -> <a href="./src/open_transit/types/where/stop/arrivals_and_departure_list_response.py">ArrivalsAndDepartureListResponse</a></code>

mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ show_error_codes = True
55
# Exclude _files.py because mypy isn't smart enough to apply
66
# the correct type narrowing and as this is an internal module
77
# it's fine to just use Pyright.
8-
exclude = ^(src/onebusaway/_files\.py|_dev/.*\.py)$
8+
exclude = ^(src/open_transit/_files\.py|_dev/.*\.py)$
99

1010
strict_equality = True
1111
implicit_reexport = True

0 commit comments

Comments
 (0)