From 50708d87aeb65e5f6e381a58407d62d51ba430e8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:37:19 +0000 Subject: [PATCH] chore(internal): codegen related update --- README.md | 10 +++++ src/prelude_python_sdk/_client.py | 63 +++++++++++++------------------ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 957e06c..3adbb90 100644 --- a/README.md +++ b/README.md @@ -325,6 +325,16 @@ client.with_options(http_client=DefaultHttpxClient(...)) By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. +```py +from prelude_python_sdk import Prelude + +with Prelude() as client: + # make requests here + ... + +# HTTP client is now closed +``` + ## Versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: diff --git a/src/prelude_python_sdk/_client.py b/src/prelude_python_sdk/_client.py index 209823f..e7706c8 100644 --- a/src/prelude_python_sdk/_client.py +++ b/src/prelude_python_sdk/_client.py @@ -8,7 +8,7 @@ import httpx -from . import resources, _exceptions +from . import _exceptions from ._qs import Querystring from ._types import ( NOT_GIVEN, @@ -24,6 +24,7 @@ get_async_library, ) from ._version import __version__ +from .resources import watch, verification, transactional from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import PreludeError, APIStatusError from ._base_client import ( @@ -32,23 +33,13 @@ AsyncAPIClient, ) -__all__ = [ - "Timeout", - "Transport", - "ProxiesTypes", - "RequestOptions", - "resources", - "Prelude", - "AsyncPrelude", - "Client", - "AsyncClient", -] +__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Prelude", "AsyncPrelude", "Client", "AsyncClient"] class Prelude(SyncAPIClient): - transactional: resources.TransactionalResource - verification: resources.VerificationResource - watch: resources.WatchResource + transactional: transactional.TransactionalResource + verification: verification.VerificationResource + watch: watch.WatchResource with_raw_response: PreludeWithRawResponse with_streaming_response: PreludeWithStreamedResponse @@ -106,9 +97,9 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.transactional = resources.TransactionalResource(self) - self.verification = resources.VerificationResource(self) - self.watch = resources.WatchResource(self) + self.transactional = transactional.TransactionalResource(self) + self.verification = verification.VerificationResource(self) + self.watch = watch.WatchResource(self) self.with_raw_response = PreludeWithRawResponse(self) self.with_streaming_response = PreludeWithStreamedResponse(self) @@ -218,9 +209,9 @@ def _make_status_error( class AsyncPrelude(AsyncAPIClient): - transactional: resources.AsyncTransactionalResource - verification: resources.AsyncVerificationResource - watch: resources.AsyncWatchResource + transactional: transactional.AsyncTransactionalResource + verification: verification.AsyncVerificationResource + watch: watch.AsyncWatchResource with_raw_response: AsyncPreludeWithRawResponse with_streaming_response: AsyncPreludeWithStreamedResponse @@ -278,9 +269,9 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.transactional = resources.AsyncTransactionalResource(self) - self.verification = resources.AsyncVerificationResource(self) - self.watch = resources.AsyncWatchResource(self) + self.transactional = transactional.AsyncTransactionalResource(self) + self.verification = verification.AsyncVerificationResource(self) + self.watch = watch.AsyncWatchResource(self) self.with_raw_response = AsyncPreludeWithRawResponse(self) self.with_streaming_response = AsyncPreludeWithStreamedResponse(self) @@ -391,30 +382,30 @@ def _make_status_error( class PreludeWithRawResponse: def __init__(self, client: Prelude) -> None: - self.transactional = resources.TransactionalResourceWithRawResponse(client.transactional) - self.verification = resources.VerificationResourceWithRawResponse(client.verification) - self.watch = resources.WatchResourceWithRawResponse(client.watch) + self.transactional = transactional.TransactionalResourceWithRawResponse(client.transactional) + self.verification = verification.VerificationResourceWithRawResponse(client.verification) + self.watch = watch.WatchResourceWithRawResponse(client.watch) class AsyncPreludeWithRawResponse: def __init__(self, client: AsyncPrelude) -> None: - self.transactional = resources.AsyncTransactionalResourceWithRawResponse(client.transactional) - self.verification = resources.AsyncVerificationResourceWithRawResponse(client.verification) - self.watch = resources.AsyncWatchResourceWithRawResponse(client.watch) + self.transactional = transactional.AsyncTransactionalResourceWithRawResponse(client.transactional) + self.verification = verification.AsyncVerificationResourceWithRawResponse(client.verification) + self.watch = watch.AsyncWatchResourceWithRawResponse(client.watch) class PreludeWithStreamedResponse: def __init__(self, client: Prelude) -> None: - self.transactional = resources.TransactionalResourceWithStreamingResponse(client.transactional) - self.verification = resources.VerificationResourceWithStreamingResponse(client.verification) - self.watch = resources.WatchResourceWithStreamingResponse(client.watch) + self.transactional = transactional.TransactionalResourceWithStreamingResponse(client.transactional) + self.verification = verification.VerificationResourceWithStreamingResponse(client.verification) + self.watch = watch.WatchResourceWithStreamingResponse(client.watch) class AsyncPreludeWithStreamedResponse: def __init__(self, client: AsyncPrelude) -> None: - self.transactional = resources.AsyncTransactionalResourceWithStreamingResponse(client.transactional) - self.verification = resources.AsyncVerificationResourceWithStreamingResponse(client.verification) - self.watch = resources.AsyncWatchResourceWithStreamingResponse(client.watch) + self.transactional = transactional.AsyncTransactionalResourceWithStreamingResponse(client.transactional) + self.verification = verification.AsyncVerificationResourceWithStreamingResponse(client.verification) + self.watch = watch.AsyncWatchResourceWithStreamingResponse(client.watch) Client = Prelude