Skip to content

Commit ec47eb9

Browse files
chore(internal): codegen related update (#425)
1 parent 00f4db3 commit ec47eb9

File tree

4 files changed

+23
-101
lines changed

4 files changed

+23
-101
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Openlayer Python library provides convenient access to the Openlayer REST AP
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

9-
It is generated with [Stainless](https://www.stainlessapi.com/).
9+
It is generated with [Stainless](https://www.stainless.com/).
1010

1111
## Documentation
1212

@@ -109,6 +109,23 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
109109

110110
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
111111

112+
## Nested params
113+
114+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
115+
116+
```python
117+
from openlayer import Openlayer
118+
119+
client = Openlayer()
120+
121+
commit = client.projects.commits.create(
122+
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
123+
commit={"message": "Updated the prompt."},
124+
storage_uri="s3://...",
125+
)
126+
print(commit.commit)
127+
```
128+
112129
## Handling errors
113130

114131
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `openlayer.APIConnectionError` is raised.

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Reporting Security Issues
44

5-
This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
5+
This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
66

7-
To report a security issue, please contact the Stainless team at security@stainlessapi.com.
7+
To report a security issue, please contact the Stainless team at security@stainless.com.
88

99
## Responsible Disclosure
1010

src/openlayer/_base_client.py

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import inspect
1010
import logging
1111
import platform
12-
import warnings
1312
import email.utils
1413
from types import TracebackType
1514
from random import random
@@ -36,7 +35,7 @@
3635
import httpx
3736
import distro
3837
import pydantic
39-
from httpx import URL, Limits
38+
from httpx import URL
4039
from pydantic import PrivateAttr
4140

4241
from . import _exceptions
@@ -51,13 +50,10 @@
5150
Timeout,
5251
NotGiven,
5352
ResponseT,
54-
Transport,
5553
AnyMapping,
5654
PostParser,
57-
ProxiesTypes,
5855
RequestFiles,
5956
HttpxSendArgs,
60-
AsyncTransport,
6157
RequestOptions,
6258
HttpxRequestFiles,
6359
ModelBuilderProtocol,
@@ -331,9 +327,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
331327
_base_url: URL
332328
max_retries: int
333329
timeout: Union[float, Timeout, None]
334-
_limits: httpx.Limits
335-
_proxies: ProxiesTypes | None
336-
_transport: Transport | AsyncTransport | None
337330
_strict_response_validation: bool
338331
_idempotency_header: str | None
339332
_default_stream_cls: type[_DefaultStreamT] | None = None
@@ -346,19 +339,13 @@ def __init__(
346339
_strict_response_validation: bool,
347340
max_retries: int = DEFAULT_MAX_RETRIES,
348341
timeout: float | Timeout | None = DEFAULT_TIMEOUT,
349-
limits: httpx.Limits,
350-
transport: Transport | AsyncTransport | None,
351-
proxies: ProxiesTypes | None,
352342
custom_headers: Mapping[str, str] | None = None,
353343
custom_query: Mapping[str, object] | None = None,
354344
) -> None:
355345
self._version = version
356346
self._base_url = self._enforce_trailing_slash(URL(base_url))
357347
self.max_retries = max_retries
358348
self.timeout = timeout
359-
self._limits = limits
360-
self._proxies = proxies
361-
self._transport = transport
362349
self._custom_headers = custom_headers or {}
363350
self._custom_query = custom_query or {}
364351
self._strict_response_validation = _strict_response_validation
@@ -784,46 +771,11 @@ def __init__(
784771
base_url: str | URL,
785772
max_retries: int = DEFAULT_MAX_RETRIES,
786773
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
787-
transport: Transport | None = None,
788-
proxies: ProxiesTypes | None = None,
789-
limits: Limits | None = None,
790774
http_client: httpx.Client | None = None,
791775
custom_headers: Mapping[str, str] | None = None,
792776
custom_query: Mapping[str, object] | None = None,
793777
_strict_response_validation: bool,
794778
) -> None:
795-
kwargs: dict[str, Any] = {}
796-
if limits is not None:
797-
warnings.warn(
798-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
799-
category=DeprecationWarning,
800-
stacklevel=3,
801-
)
802-
if http_client is not None:
803-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
804-
else:
805-
limits = DEFAULT_CONNECTION_LIMITS
806-
807-
if transport is not None:
808-
kwargs["transport"] = transport
809-
warnings.warn(
810-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
811-
category=DeprecationWarning,
812-
stacklevel=3,
813-
)
814-
if http_client is not None:
815-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
816-
817-
if proxies is not None:
818-
kwargs["proxies"] = proxies
819-
warnings.warn(
820-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
821-
category=DeprecationWarning,
822-
stacklevel=3,
823-
)
824-
if http_client is not None:
825-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
826-
827779
if not is_given(timeout):
828780
# if the user passed in a custom http client with a non-default
829781
# timeout set then we use that timeout.
@@ -844,12 +796,9 @@ def __init__(
844796

845797
super().__init__(
846798
version=version,
847-
limits=limits,
848799
# cast to a valid type because mypy doesn't understand our type narrowing
849800
timeout=cast(Timeout, timeout),
850-
proxies=proxies,
851801
base_url=base_url,
852-
transport=transport,
853802
max_retries=max_retries,
854803
custom_query=custom_query,
855804
custom_headers=custom_headers,
@@ -859,9 +808,6 @@ def __init__(
859808
base_url=base_url,
860809
# cast to a valid type because mypy doesn't understand our type narrowing
861810
timeout=cast(Timeout, timeout),
862-
limits=limits,
863-
follow_redirects=True,
864-
**kwargs, # type: ignore
865811
)
866812

867813
def is_closed(self) -> bool:
@@ -1353,45 +1299,10 @@ def __init__(
13531299
_strict_response_validation: bool,
13541300
max_retries: int = DEFAULT_MAX_RETRIES,
13551301
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
1356-
transport: AsyncTransport | None = None,
1357-
proxies: ProxiesTypes | None = None,
1358-
limits: Limits | None = None,
13591302
http_client: httpx.AsyncClient | None = None,
13601303
custom_headers: Mapping[str, str] | None = None,
13611304
custom_query: Mapping[str, object] | None = None,
13621305
) -> None:
1363-
kwargs: dict[str, Any] = {}
1364-
if limits is not None:
1365-
warnings.warn(
1366-
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
1367-
category=DeprecationWarning,
1368-
stacklevel=3,
1369-
)
1370-
if http_client is not None:
1371-
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
1372-
else:
1373-
limits = DEFAULT_CONNECTION_LIMITS
1374-
1375-
if transport is not None:
1376-
kwargs["transport"] = transport
1377-
warnings.warn(
1378-
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
1379-
category=DeprecationWarning,
1380-
stacklevel=3,
1381-
)
1382-
if http_client is not None:
1383-
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
1384-
1385-
if proxies is not None:
1386-
kwargs["proxies"] = proxies
1387-
warnings.warn(
1388-
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
1389-
category=DeprecationWarning,
1390-
stacklevel=3,
1391-
)
1392-
if http_client is not None:
1393-
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
1394-
13951306
if not is_given(timeout):
13961307
# if the user passed in a custom http client with a non-default
13971308
# timeout set then we use that timeout.
@@ -1413,11 +1324,8 @@ def __init__(
14131324
super().__init__(
14141325
version=version,
14151326
base_url=base_url,
1416-
limits=limits,
14171327
# cast to a valid type because mypy doesn't understand our type narrowing
14181328
timeout=cast(Timeout, timeout),
1419-
proxies=proxies,
1420-
transport=transport,
14211329
max_retries=max_retries,
14221330
custom_query=custom_query,
14231331
custom_headers=custom_headers,
@@ -1427,9 +1335,6 @@ def __init__(
14271335
base_url=base_url,
14281336
# cast to a valid type because mypy doesn't understand our type narrowing
14291337
timeout=cast(Timeout, timeout),
1430-
limits=limits,
1431-
follow_redirects=True,
1432-
**kwargs, # type: ignore
14331338
)
14341339

14351340
def is_closed(self) -> bool:

src/openlayer/_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(
8383
# part of our public interface in the future.
8484
_strict_response_validation: bool = False,
8585
) -> None:
86-
"""Construct a new synchronous openlayer client instance.
86+
"""Construct a new synchronous Openlayer client instance.
8787
8888
This automatically infers the `api_key` argument from the `OPENLAYER_API_KEY` environment variable if it is not provided.
8989
"""
@@ -266,7 +266,7 @@ def __init__(
266266
# part of our public interface in the future.
267267
_strict_response_validation: bool = False,
268268
) -> None:
269-
"""Construct a new async openlayer client instance.
269+
"""Construct a new async AsyncOpenlayer client instance.
270270
271271
This automatically infers the `api_key` argument from the `OPENLAYER_API_KEY` environment variable if it is not provided.
272272
"""

0 commit comments

Comments
 (0)