Skip to content

Commit 7586440

Browse files
committed
feat(api): update via SDK Studio
1 parent 9d44ad8 commit 7586440

21 files changed

+221
-217
lines changed

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 Onebusaway SDK
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: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# One Bus Away Python API library
1+
# Onebusaway SDK Python API library
22

33
[![PyPI version](https://img.shields.io/pypi/v/onebusaway.svg)](https://pypi.org/project/onebusaway/)
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 Onebusaway SDK Python library provides convenient access to the Onebusaway SDK 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

@@ -28,9 +28,9 @@ 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 onebusaway import OnebusawaySDK
3232

33-
client = OneBusAway(
33+
client = OnebusawaySDK(
3434
# This is the default and can be omitted
3535
api_key=os.environ.get("ONEBUSAWAY_API_KEY"),
3636
)
@@ -45,14 +45,14 @@ so that your API Key is not stored in source control.
4545

4646
## Async usage
4747

48-
Simply import `AsyncOneBusAway` instead of `OneBusAway` and use `await` with each API call:
48+
Simply import `AsyncOnebusawaySDK` instead of `OnebusawaySDK` and use `await` with each API call:
4949

5050
```python
5151
import os
5252
import asyncio
53-
from onebusaway import AsyncOneBusAway
53+
from onebusaway import AsyncOnebusawaySDK
5454

55-
client = AsyncOneBusAway(
55+
client = AsyncOnebusawaySDK(
5656
# This is the default and can be omitted
5757
api_key=os.environ.get("ONEBUSAWAY_API_KEY"),
5858
)
@@ -87,9 +87,9 @@ All errors inherit from `onebusaway.APIError`.
8787

8888
```python
8989
import onebusaway
90-
from onebusaway import OneBusAway
90+
from onebusaway import OnebusawaySDK
9191

92-
client = OneBusAway()
92+
client = OnebusawaySDK()
9393

9494
try:
9595
client.current_time.retrieve()
@@ -126,10 +126,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
126126
You can use the `max_retries` option to configure or disable retry settings:
127127

128128
```python
129-
from onebusaway import OneBusAway
129+
from onebusaway import OnebusawaySDK
130130

131131
# Configure the default for all requests:
132-
client = OneBusAway(
132+
client = OnebusawaySDK(
133133
# default is 2
134134
max_retries=0,
135135
)
@@ -144,16 +144,16 @@ By default requests time out after 1 minute. You can configure this with a `time
144144
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
145145

146146
```python
147-
from onebusaway import OneBusAway
147+
from onebusaway import OnebusawaySDK
148148

149149
# Configure the default for all requests:
150-
client = OneBusAway(
150+
client = OnebusawaySDK(
151151
# 20 seconds (default is 1 minute)
152152
timeout=20.0,
153153
)
154154

155155
# More granular control:
156-
client = OneBusAway(
156+
client = OnebusawaySDK(
157157
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
158158
)
159159

@@ -171,10 +171,10 @@ Note that requests that time out are [retried twice by default](#retries).
171171

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

174-
You can enable logging by setting the environment variable `ONE_BUS_AWAY_LOG` to `debug`.
174+
You can enable logging by setting the environment variable `ONEBUSAWAY_SDK_LOG` to `debug`.
175175

176176
```shell
177-
$ export ONE_BUS_AWAY_LOG=debug
177+
$ export ONEBUSAWAY_SDK_LOG=debug
178178
```
179179

180180
### How to tell whether `None` means `null` or missing
@@ -194,9 +194,9 @@ if response.my_field is None:
194194
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
195195

196196
```py
197-
from onebusaway import OneBusAway
197+
from onebusaway import OnebusawaySDK
198198

199-
client = OneBusAway()
199+
client = OnebusawaySDK()
200200
response = client.current_time.with_raw_response.retrieve()
201201
print(response.headers.get('X-My-Header'))
202202

@@ -268,10 +268,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
268268
- Additional [advanced](https://www.python-httpx.org/advanced/#client-instances) functionality
269269

270270
```python
271-
from onebusaway import OneBusAway, DefaultHttpxClient
271+
from onebusaway import OnebusawaySDK, DefaultHttpxClient
272272

273-
client = OneBusAway(
274-
# Or use the `ONE_BUS_AWAY_BASE_URL` env var
273+
client = OnebusawaySDK(
274+
# Or use the `ONEBUSAWAY_SDK_BASE_URL` env var
275275
base_url="http://my.test.server.example.com:8083",
276276
http_client=DefaultHttpxClient(
277277
proxies="http://my.test.proxy.example.com",

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ 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 Onebusaway SDK please follow the respective company's security reporting guidelines.
2020

21-
### One Bus Away Terms and Policies
21+
### Onebusaway SDK Terms and Policies
2222

2323
Please contact info@onebusaway.org for any questions or concerns regarding security of our services.
2424

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
22
name = "onebusaway"
33
version = "0.0.1-alpha.0"
4-
description = "The official Python library for the OneBusAway API"
4+
description = "The official Python library for the onebusaway-sdk API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
77
authors = [
8-
{ name = "One Bus Away", email = "info@onebusaway.org" },
8+
{ name = "Onebusaway SDK", email = "info@onebusaway.org" },
99
]
1010
dependencies = [
1111
"httpx>=0.23.0, <1",

src/onebusaway/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
Stream,
99
Timeout,
1010
Transport,
11-
OneBusAway,
1211
AsyncClient,
1312
AsyncStream,
13+
OnebusawaySDK,
1414
RequestOptions,
15-
AsyncOneBusAway,
15+
AsyncOnebusawaySDK,
1616
)
1717
from ._models import BaseModel
1818
from ._version import __title__, __version__
@@ -26,8 +26,8 @@
2626
RateLimitError,
2727
APITimeoutError,
2828
BadRequestError,
29-
OneBusAwayError,
3029
APIConnectionError,
30+
OnebusawaySDKError,
3131
AuthenticationError,
3232
InternalServerError,
3333
PermissionDeniedError,
@@ -46,7 +46,7 @@
4646
"ProxiesTypes",
4747
"NotGiven",
4848
"NOT_GIVEN",
49-
"OneBusAwayError",
49+
"OnebusawaySDKError",
5050
"APIError",
5151
"APIStatusError",
5252
"APITimeoutError",
@@ -66,8 +66,8 @@
6666
"AsyncClient",
6767
"Stream",
6868
"AsyncStream",
69-
"OneBusAway",
70-
"AsyncOneBusAway",
69+
"OnebusawaySDK",
70+
"AsyncOnebusawaySDK",
7171
"file_from_path",
7272
"BaseModel",
7373
"DEFAULT_TIMEOUT",

src/onebusaway/_client.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626
from ._version import __version__
2727
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
28-
from ._exceptions import APIStatusError, OneBusAwayError
28+
from ._exceptions import APIStatusError, OnebusawaySDKError
2929
from ._base_client import (
3030
DEFAULT_MAX_RETRIES,
3131
SyncAPIClient,
@@ -38,22 +38,22 @@
3838
"ProxiesTypes",
3939
"RequestOptions",
4040
"resources",
41-
"OneBusAway",
42-
"AsyncOneBusAway",
41+
"OnebusawaySDK",
42+
"AsyncOnebusawaySDK",
4343
"Client",
4444
"AsyncClient",
4545
]
4646

4747

48-
class OneBusAway(SyncAPIClient):
48+
class OnebusawaySDK(SyncAPIClient):
4949
agencies_with_coverage: resources.AgenciesWithCoverageResource
5050
config: resources.ConfigResource
5151
current_time: resources.CurrentTimeResource
5252
stops_for_location: resources.StopsForLocationResource
5353
arrival_and_departure_for_stop: resources.ArrivalAndDepartureForStopResource
5454
arrivals_and_departures_for_stop: resources.ArrivalsAndDeparturesForStopResource
55-
with_raw_response: OneBusAwayWithRawResponse
56-
with_streaming_response: OneBusAwayWithStreamedResponse
55+
with_raw_response: OnebusawaySDKWithRawResponse
56+
with_streaming_response: OnebusawaySDKWithStreamedResponse
5757

5858
# client options
5959
api_key: str
@@ -81,20 +81,20 @@ def __init__(
8181
# part of our public interface in the future.
8282
_strict_response_validation: bool = False,
8383
) -> None:
84-
"""Construct a new synchronous OneBusAway client instance.
84+
"""Construct a new synchronous onebusaway-sdk client instance.
8585
8686
This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided.
8787
"""
8888
if api_key is None:
8989
api_key = os.environ.get("ONEBUSAWAY_API_KEY")
9090
if api_key is None:
91-
raise OneBusAwayError(
91+
raise OnebusawaySDKError(
9292
"The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable"
9393
)
9494
self.api_key = api_key
9595

9696
if base_url is None:
97-
base_url = os.environ.get("ONE_BUS_AWAY_BASE_URL")
97+
base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL")
9898
if base_url is None:
9999
base_url = f"https://api.pugetsound.onebusaway.org"
100100

@@ -115,8 +115,8 @@ def __init__(
115115
self.stops_for_location = resources.StopsForLocationResource(self)
116116
self.arrival_and_departure_for_stop = resources.ArrivalAndDepartureForStopResource(self)
117117
self.arrivals_and_departures_for_stop = resources.ArrivalsAndDeparturesForStopResource(self)
118-
self.with_raw_response = OneBusAwayWithRawResponse(self)
119-
self.with_streaming_response = OneBusAwayWithStreamedResponse(self)
118+
self.with_raw_response = OnebusawaySDKWithRawResponse(self)
119+
self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self)
120120

121121
@property
122122
@override
@@ -230,15 +230,15 @@ def _make_status_error(
230230
return APIStatusError(err_msg, response=response, body=body)
231231

232232

233-
class AsyncOneBusAway(AsyncAPIClient):
233+
class AsyncOnebusawaySDK(AsyncAPIClient):
234234
agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource
235235
config: resources.AsyncConfigResource
236236
current_time: resources.AsyncCurrentTimeResource
237237
stops_for_location: resources.AsyncStopsForLocationResource
238238
arrival_and_departure_for_stop: resources.AsyncArrivalAndDepartureForStopResource
239239
arrivals_and_departures_for_stop: resources.AsyncArrivalsAndDeparturesForStopResource
240-
with_raw_response: AsyncOneBusAwayWithRawResponse
241-
with_streaming_response: AsyncOneBusAwayWithStreamedResponse
240+
with_raw_response: AsyncOnebusawaySDKWithRawResponse
241+
with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse
242242

243243
# client options
244244
api_key: str
@@ -266,20 +266,20 @@ def __init__(
266266
# part of our public interface in the future.
267267
_strict_response_validation: bool = False,
268268
) -> None:
269-
"""Construct a new async OneBusAway client instance.
269+
"""Construct a new async onebusaway-sdk client instance.
270270
271271
This automatically infers the `api_key` argument from the `ONEBUSAWAY_API_KEY` environment variable if it is not provided.
272272
"""
273273
if api_key is None:
274274
api_key = os.environ.get("ONEBUSAWAY_API_KEY")
275275
if api_key is None:
276-
raise OneBusAwayError(
276+
raise OnebusawaySDKError(
277277
"The api_key client option must be set either by passing api_key to the client or by setting the ONEBUSAWAY_API_KEY environment variable"
278278
)
279279
self.api_key = api_key
280280

281281
if base_url is None:
282-
base_url = os.environ.get("ONE_BUS_AWAY_BASE_URL")
282+
base_url = os.environ.get("ONEBUSAWAY_SDK_BASE_URL")
283283
if base_url is None:
284284
base_url = f"https://api.pugetsound.onebusaway.org"
285285

@@ -300,8 +300,8 @@ def __init__(
300300
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
301301
self.arrival_and_departure_for_stop = resources.AsyncArrivalAndDepartureForStopResource(self)
302302
self.arrivals_and_departures_for_stop = resources.AsyncArrivalsAndDeparturesForStopResource(self)
303-
self.with_raw_response = AsyncOneBusAwayWithRawResponse(self)
304-
self.with_streaming_response = AsyncOneBusAwayWithStreamedResponse(self)
303+
self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self)
304+
self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self)
305305

306306
@property
307307
@override
@@ -415,8 +415,8 @@ def _make_status_error(
415415
return APIStatusError(err_msg, response=response, body=body)
416416

417417

418-
class OneBusAwayWithRawResponse:
419-
def __init__(self, client: OneBusAway) -> None:
418+
class OnebusawaySDKWithRawResponse:
419+
def __init__(self, client: OnebusawaySDK) -> None:
420420
self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithRawResponse(
421421
client.agencies_with_coverage
422422
)
@@ -431,8 +431,8 @@ def __init__(self, client: OneBusAway) -> None:
431431
)
432432

433433

434-
class AsyncOneBusAwayWithRawResponse:
435-
def __init__(self, client: AsyncOneBusAway) -> None:
434+
class AsyncOnebusawaySDKWithRawResponse:
435+
def __init__(self, client: AsyncOnebusawaySDK) -> None:
436436
self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithRawResponse(
437437
client.agencies_with_coverage
438438
)
@@ -447,8 +447,8 @@ def __init__(self, client: AsyncOneBusAway) -> None:
447447
)
448448

449449

450-
class OneBusAwayWithStreamedResponse:
451-
def __init__(self, client: OneBusAway) -> None:
450+
class OnebusawaySDKWithStreamedResponse:
451+
def __init__(self, client: OnebusawaySDK) -> None:
452452
self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithStreamingResponse(
453453
client.agencies_with_coverage
454454
)
@@ -463,8 +463,8 @@ def __init__(self, client: OneBusAway) -> None:
463463
)
464464

465465

466-
class AsyncOneBusAwayWithStreamedResponse:
467-
def __init__(self, client: AsyncOneBusAway) -> None:
466+
class AsyncOnebusawaySDKWithStreamedResponse:
467+
def __init__(self, client: AsyncOnebusawaySDK) -> None:
468468
self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithStreamingResponse(
469469
client.agencies_with_coverage
470470
)
@@ -483,6 +483,6 @@ def __init__(self, client: AsyncOneBusAway) -> None:
483483
)
484484

485485

486-
Client = OneBusAway
486+
Client = OnebusawaySDK
487487

488-
AsyncClient = AsyncOneBusAway
488+
AsyncClient = AsyncOnebusawaySDK

src/onebusaway/_exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
]
1919

2020

21-
class OneBusAwayError(Exception):
21+
class OnebusawaySDKError(Exception):
2222
pass
2323

2424

25-
class APIError(OneBusAwayError):
25+
class APIError(OnebusawaySDKError):
2626
message: str
2727
request: httpx.Request
2828

0 commit comments

Comments
 (0)