From da88e9eee0adc6152d0d8212305397483be0d686 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:44:31 +0000 Subject: [PATCH 1/4] feat(api): manual updates --- src/gradient/_client.py | 20 ++++++++++++++++++++ tests/conftest.py | 17 ++--------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/gradient/_client.py b/src/gradient/_client.py index 77cc446e..58bc42d9 100644 --- a/src/gradient/_client.py +++ b/src/gradient/_client.py @@ -291,6 +291,16 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: if isinstance(custom_headers.get("Authorization"), Omit): return + if self.model_access_key and headers.get("Authorization"): + return + if isinstance(custom_headers.get("Authorization"), Omit): + return + + if self.agent_access_key and headers.get("Authorization"): + return + if isinstance(custom_headers.get("Authorization"), Omit): + return + raise TypeError( '"Could not resolve authentication method. Expected access_token, agent_access_key, or model_access_key to be set. Or for the `Authorization` headers to be explicitly omitted"' ) @@ -614,6 +624,16 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: if isinstance(custom_headers.get("Authorization"), Omit): return + if self.model_access_key and headers.get("Authorization"): + return + if isinstance(custom_headers.get("Authorization"), Omit): + return + + if self.agent_access_key and headers.get("Authorization"): + return + if isinstance(custom_headers.get("Authorization"), Omit): + return + raise TypeError( '"Could not resolve authentication method. Expected access_token, agent_access_key, or model_access_key to be set. Or for the `Authorization` headers to be explicitly omitted"' ) diff --git a/tests/conftest.py b/tests/conftest.py index bc2aa92e..0a1890ae 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -46,8 +46,6 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") access_token = "My Access Token" -model_access_key = "My Model Access Key" -agent_access_key = "My Agent Access Key" @pytest.fixture(scope="session") @@ -56,13 +54,7 @@ def client(request: FixtureRequest) -> Iterator[Gradient]: if not isinstance(strict, bool): raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - with Gradient( - base_url=base_url, - access_token=access_token, - model_access_key=model_access_key, - agent_access_key=agent_access_key, - _strict_response_validation=strict, - ) as client: + with Gradient(base_url=base_url, access_token=access_token, _strict_response_validation=strict) as client: yield client @@ -87,11 +79,6 @@ async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncGradient]: raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict") async with AsyncGradient( - base_url=base_url, - access_token=access_token, - model_access_key=model_access_key, - agent_access_key=agent_access_key, - _strict_response_validation=strict, - http_client=http_client, + base_url=base_url, access_token=access_token, _strict_response_validation=strict, http_client=http_client ) as client: yield client From 01ac735fb965686699df82ec8763b18ceb660972 Mon Sep 17 00:00:00 2001 From: Ben Batha Date: Thu, 16 Oct 2025 11:05:36 -0400 Subject: [PATCH 2/4] fix: test setup needs all three access keys --- tests/conftest.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0a1890ae..974f8a80 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,7 +14,9 @@ from gradient._utils import is_dict if TYPE_CHECKING: - from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage] + from _pytest.fixtures import ( + FixtureRequest, + ) # pyright: ignore[reportPrivateImportUsage] pytest.register_assert_rewrite("tests.utils") @@ -46,6 +48,8 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") access_token = "My Access Token" +model_access_key = "My Model Access Key" +agent_access_key = "My Agent Access Key" @pytest.fixture(scope="session") @@ -54,7 +58,13 @@ def client(request: FixtureRequest) -> Iterator[Gradient]: if not isinstance(strict, bool): raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - with Gradient(base_url=base_url, access_token=access_token, _strict_response_validation=strict) as client: + with Gradient( + base_url=base_url, + access_token=access_token, + model_access_key=model_access_key, + agent_access_key=agent_access_key, + _strict_response_validation=strict, + ) as client: yield client @@ -79,6 +89,11 @@ async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncGradient]: raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict") async with AsyncGradient( - base_url=base_url, access_token=access_token, _strict_response_validation=strict, http_client=http_client + base_url=base_url, + access_token=access_token, + model_access_key=model_access_key, + agent_access_key=agent_access_key, + _strict_response_validation=strict, + http_client=http_client, ) as client: yield client From a1b1fc6b7747c00d9bfc2b86c6262e9c123416dc Mon Sep 17 00:00:00 2001 From: Ben Batha Date: Thu, 16 Oct 2025 11:31:52 -0400 Subject: [PATCH 3/4] fix: lints --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 974f8a80..3915c92b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,8 +15,8 @@ if TYPE_CHECKING: from _pytest.fixtures import ( - FixtureRequest, - ) # pyright: ignore[reportPrivateImportUsage] + FixtureRequest, # pyright: ignore[reportPrivateImportUsage] + ) pytest.register_assert_rewrite("tests.utils") From 9dab22d9a3f0d82959b27a167b089735c5f40d7c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 16 Oct 2025 15:32:18 +0000 Subject: [PATCH 4/4] release: 3.6.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ pyproject.toml | 2 +- src/gradient/_version.py | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bf0d0361..f391d416 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.5.0" + ".": "3.6.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e8b1d5..b8cc8f24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 3.6.0 (2025-10-16) + +Full Changelog: [v3.5.0...v3.6.0](https://github.com/digitalocean/gradient-python/compare/v3.5.0...v3.6.0) + +### Features + +* **api:** manual updates ([da88e9e](https://github.com/digitalocean/gradient-python/commit/da88e9eee0adc6152d0d8212305397483be0d686)) + + +### Bug Fixes + +* lints ([a1b1fc6](https://github.com/digitalocean/gradient-python/commit/a1b1fc6b7747c00d9bfc2b86c6262e9c123416dc)) +* test setup needs all three access keys ([01ac735](https://github.com/digitalocean/gradient-python/commit/01ac735fb965686699df82ec8763b18ceb660972)) + ## 3.5.0 (2025-10-14) Full Changelog: [v3.4.0...v3.5.0](https://github.com/digitalocean/gradient-python/compare/v3.4.0...v3.5.0) diff --git a/pyproject.toml b/pyproject.toml index b9dbc5ea..0eb040eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gradient" -version = "3.5.0" +version = "3.6.0" description = "The official Python library for the Gradient API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/gradient/_version.py b/src/gradient/_version.py index 68c981bc..0190d688 100644 --- a/src/gradient/_version.py +++ b/src/gradient/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gradient" -__version__ = "3.5.0" # x-release-please-version +__version__ = "3.6.0" # x-release-please-version