From 77df827c2608b4326d707c0ecbc93d7ec83957d5 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 28 Nov 2025 03:04:08 +0000
Subject: [PATCH 1/5] fix: ensure streams are always closed
---
src/brand/dev/_streaming.py | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/brand/dev/_streaming.py b/src/brand/dev/_streaming.py
index a61de0d..488f08c 100644
--- a/src/brand/dev/_streaming.py
+++ b/src/brand/dev/_streaming.py
@@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]:
process_data = self._client._process_response_data
iterator = self._iter_events()
- for sse in iterator:
- yield process_data(data=sse.json(), cast_to=cast_to, response=response)
-
- # As we might not fully consume the response stream, we need to close it explicitly
- response.close()
+ try:
+ for sse in iterator:
+ yield process_data(data=sse.json(), cast_to=cast_to, response=response)
+ finally:
+ # Ensure the response is closed even if the consumer doesn't read all data
+ response.close()
def __enter__(self) -> Self:
return self
@@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]:
process_data = self._client._process_response_data
iterator = self._iter_events()
- async for sse in iterator:
- yield process_data(data=sse.json(), cast_to=cast_to, response=response)
-
- # As we might not fully consume the response stream, we need to close it explicitly
- await response.aclose()
+ try:
+ async for sse in iterator:
+ yield process_data(data=sse.json(), cast_to=cast_to, response=response)
+ finally:
+ # Ensure the response is closed even if the consumer doesn't read all data
+ await response.aclose()
async def __aenter__(self) -> Self:
return self
From eedd772cb757bcff196b6ed21ac9e887b8423fe0 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 28 Nov 2025 03:05:10 +0000
Subject: [PATCH 2/5] chore(deps): mypy 1.18.1 has a regression, pin to 1.17
---
pyproject.toml | 2 +-
requirements-dev.lock | 4 +++-
requirements.lock | 8 ++++----
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 26c4f9f..5c9736d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -46,7 +46,7 @@ managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
"pyright==1.1.399",
- "mypy",
+ "mypy==1.17",
"respx",
"pytest",
"pytest-asyncio",
diff --git a/requirements-dev.lock b/requirements-dev.lock
index e8a6c7a..07ab979 100644
--- a/requirements-dev.lock
+++ b/requirements-dev.lock
@@ -72,7 +72,7 @@ mdurl==0.1.2
multidict==6.4.4
# via aiohttp
# via yarl
-mypy==1.14.1
+mypy==1.17.0
mypy-extensions==1.0.0
# via mypy
nodeenv==1.8.0
@@ -81,6 +81,8 @@ nox==2023.4.22
packaging==23.2
# via nox
# via pytest
+pathspec==0.12.1
+ # via mypy
platformdirs==3.11.0
# via virtualenv
pluggy==1.5.0
diff --git a/requirements.lock b/requirements.lock
index de9aff9..3ac2e1b 100644
--- a/requirements.lock
+++ b/requirements.lock
@@ -55,21 +55,21 @@ multidict==6.4.4
propcache==0.3.1
# via aiohttp
# via yarl
-pydantic==2.11.9
+pydantic==2.12.5
# via brand-dev
-pydantic-core==2.33.2
+pydantic-core==2.41.5
# via pydantic
sniffio==1.3.0
# via anyio
# via brand-dev
-typing-extensions==4.12.2
+typing-extensions==4.15.0
# via anyio
# via brand-dev
# via multidict
# via pydantic
# via pydantic-core
# via typing-inspection
-typing-inspection==0.4.1
+typing-inspection==0.4.2
# via pydantic
yarl==1.20.0
# via aiohttp
From 32fd8a979e6bef1ef3169a2e9e32a2edca0ab1a8 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 29 Nov 2025 20:44:32 +0000
Subject: [PATCH 3/5] codegen metadata
---
.stats.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index d76eb3c..1fdc5f7 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 12
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-fff3572a2d6f3a8461fbf52fb74882e1f4ae4a2b31a75673dcae230b336911d2.yml
-openapi_spec_hash: b04ce3c7879b31f1e38cd76372e8e652
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-f69782c2c4296df9db6b41a3a7359a9e4910f59e34901b9f0e8045cec3f9ca69.yml
+openapi_spec_hash: f06c3956a6fc7e57614b120910339747
config_hash: 86160e220c81f47769a71c9343e486d8
From d95285ae339e8df4d50e793e7c9938ac226974f1 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 29 Nov 2025 20:55:27 +0000
Subject: [PATCH 4/5] feat(api): manual updates
---
.stats.yml | 4 +-
api.md | 2 +
src/brand/dev/resources/brand.py | 114 ++++++++++++++++++++
src/brand/dev/types/__init__.py | 2 +
src/brand/dev/types/brand_fonts_params.py | 24 +++++
src/brand/dev/types/brand_fonts_response.py | 44 ++++++++
tests/api_resources/test_brand.py | 87 +++++++++++++++
7 files changed, 275 insertions(+), 2 deletions(-)
create mode 100644 src/brand/dev/types/brand_fonts_params.py
create mode 100644 src/brand/dev/types/brand_fonts_response.py
diff --git a/.stats.yml b/.stats.yml
index 1fdc5f7..e312258 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 12
+configured_endpoints: 13
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-f69782c2c4296df9db6b41a3a7359a9e4910f59e34901b9f0e8045cec3f9ca69.yml
openapi_spec_hash: f06c3956a6fc7e57614b120910339747
-config_hash: 86160e220c81f47769a71c9343e486d8
+config_hash: 6aaf0fe6f8877c9c5d9af95597123cb4
diff --git a/api.md b/api.md
index cd8c7b2..6ad80e3 100644
--- a/api.md
+++ b/api.md
@@ -6,6 +6,7 @@ Types:
from brand.dev.types import (
BrandRetrieveResponse,
BrandAIQueryResponse,
+ BrandFontsResponse,
BrandIdentifyFromTransactionResponse,
BrandPrefetchResponse,
BrandRetrieveByEmailResponse,
@@ -23,6 +24,7 @@ Methods:
- client.brand.retrieve(\*\*params) -> BrandRetrieveResponse
- client.brand.ai_query(\*\*params) -> BrandAIQueryResponse
+- client.brand.fonts(\*\*params) -> BrandFontsResponse
- client.brand.identify_from_transaction(\*\*params) -> BrandIdentifyFromTransactionResponse
- client.brand.prefetch(\*\*params) -> BrandPrefetchResponse
- client.brand.retrieve_by_email(\*\*params) -> BrandRetrieveByEmailResponse
diff --git a/src/brand/dev/resources/brand.py b/src/brand/dev/resources/brand.py
index a795094..deb7219 100644
--- a/src/brand/dev/resources/brand.py
+++ b/src/brand/dev/resources/brand.py
@@ -8,6 +8,7 @@
import httpx
from ..types import (
+ brand_fonts_params,
brand_ai_query_params,
brand_prefetch_params,
brand_retrieve_params,
@@ -32,6 +33,7 @@
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
+from ..types.brand_fonts_response import BrandFontsResponse
from ..types.brand_ai_query_response import BrandAIQueryResponse
from ..types.brand_prefetch_response import BrandPrefetchResponse
from ..types.brand_retrieve_response import BrandRetrieveResponse
@@ -239,6 +241,56 @@ def ai_query(
cast_to=BrandAIQueryResponse,
)
+ def fonts(
+ self,
+ *,
+ domain: str,
+ timeout_ms: int | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> BrandFontsResponse:
+ """
+ Beta feature: Extract font information from a brand's website including font
+ families, usage statistics, fallbacks, and element/word counts.
+
+ Args:
+ domain: Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The
+ domain will be automatically normalized and validated.
+
+ timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer
+ than this value, it will be aborted with a 408 status code. Maximum allowed
+ value is 300000ms (5 minutes).
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._get(
+ "/brand/fonts",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "domain": domain,
+ "timeout_ms": timeout_ms,
+ },
+ brand_fonts_params.BrandFontsParams,
+ ),
+ ),
+ cast_to=BrandFontsResponse,
+ )
+
def identify_from_transaction(
self,
*,
@@ -1612,6 +1664,56 @@ async def ai_query(
cast_to=BrandAIQueryResponse,
)
+ async def fonts(
+ self,
+ *,
+ domain: str,
+ timeout_ms: int | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> BrandFontsResponse:
+ """
+ Beta feature: Extract font information from a brand's website including font
+ families, usage statistics, fallbacks, and element/word counts.
+
+ Args:
+ domain: Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The
+ domain will be automatically normalized and validated.
+
+ timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer
+ than this value, it will be aborted with a 408 status code. Maximum allowed
+ value is 300000ms (5 minutes).
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._get(
+ "/brand/fonts",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "domain": domain,
+ "timeout_ms": timeout_ms,
+ },
+ brand_fonts_params.BrandFontsParams,
+ ),
+ ),
+ cast_to=BrandFontsResponse,
+ )
+
async def identify_from_transaction(
self,
*,
@@ -2804,6 +2906,9 @@ def __init__(self, brand: BrandResource) -> None:
self.ai_query = to_raw_response_wrapper(
brand.ai_query,
)
+ self.fonts = to_raw_response_wrapper(
+ brand.fonts,
+ )
self.identify_from_transaction = to_raw_response_wrapper(
brand.identify_from_transaction,
)
@@ -2846,6 +2951,9 @@ def __init__(self, brand: AsyncBrandResource) -> None:
self.ai_query = async_to_raw_response_wrapper(
brand.ai_query,
)
+ self.fonts = async_to_raw_response_wrapper(
+ brand.fonts,
+ )
self.identify_from_transaction = async_to_raw_response_wrapper(
brand.identify_from_transaction,
)
@@ -2888,6 +2996,9 @@ def __init__(self, brand: BrandResource) -> None:
self.ai_query = to_streamed_response_wrapper(
brand.ai_query,
)
+ self.fonts = to_streamed_response_wrapper(
+ brand.fonts,
+ )
self.identify_from_transaction = to_streamed_response_wrapper(
brand.identify_from_transaction,
)
@@ -2930,6 +3041,9 @@ def __init__(self, brand: AsyncBrandResource) -> None:
self.ai_query = async_to_streamed_response_wrapper(
brand.ai_query,
)
+ self.fonts = async_to_streamed_response_wrapper(
+ brand.fonts,
+ )
self.identify_from_transaction = async_to_streamed_response_wrapper(
brand.identify_from_transaction,
)
diff --git a/src/brand/dev/types/__init__.py b/src/brand/dev/types/__init__.py
index eae55c9..9c3f961 100644
--- a/src/brand/dev/types/__init__.py
+++ b/src/brand/dev/types/__init__.py
@@ -2,6 +2,8 @@
from __future__ import annotations
+from .brand_fonts_params import BrandFontsParams as BrandFontsParams
+from .brand_fonts_response import BrandFontsResponse as BrandFontsResponse
from .brand_ai_query_params import BrandAIQueryParams as BrandAIQueryParams
from .brand_prefetch_params import BrandPrefetchParams as BrandPrefetchParams
from .brand_retrieve_params import BrandRetrieveParams as BrandRetrieveParams
diff --git a/src/brand/dev/types/brand_fonts_params.py b/src/brand/dev/types/brand_fonts_params.py
new file mode 100644
index 0000000..db13d2f
--- /dev/null
+++ b/src/brand/dev/types/brand_fonts_params.py
@@ -0,0 +1,24 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["BrandFontsParams"]
+
+
+class BrandFontsParams(TypedDict, total=False):
+ domain: Required[str]
+ """Domain name to extract fonts from (e.g., 'example.com', 'google.com').
+
+ The domain will be automatically normalized and validated.
+ """
+
+ timeout_ms: Annotated[int, PropertyInfo(alias="timeoutMS")]
+ """Optional timeout in milliseconds for the request.
+
+ If the request takes longer than this value, it will be aborted with a 408
+ status code. Maximum allowed value is 300000ms (5 minutes).
+ """
diff --git a/src/brand/dev/types/brand_fonts_response.py b/src/brand/dev/types/brand_fonts_response.py
new file mode 100644
index 0000000..2721af9
--- /dev/null
+++ b/src/brand/dev/types/brand_fonts_response.py
@@ -0,0 +1,44 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List
+
+from .._models import BaseModel
+
+__all__ = ["BrandFontsResponse", "Font"]
+
+
+class Font(BaseModel):
+ fallbacks: List[str]
+ """Array of fallback font families"""
+
+ font: str
+ """Font family name"""
+
+ num_elements: float
+ """Number of elements using this font"""
+
+ num_words: float
+ """Number of words using this font"""
+
+ percent_elements: float
+ """Percentage of elements using this font"""
+
+ percent_words: float
+ """Percentage of words using this font"""
+
+ uses: List[str]
+ """Array of CSS selectors or element types where this font is used"""
+
+
+class BrandFontsResponse(BaseModel):
+ code: int
+ """HTTP status code, e.g., 200"""
+
+ domain: str
+ """The normalized domain that was processed"""
+
+ fonts: List[Font]
+ """Array of font usage information"""
+
+ status: str
+ """Status of the response, e.g., 'ok'"""
diff --git a/tests/api_resources/test_brand.py b/tests/api_resources/test_brand.py
index c246b79..43fa03b 100644
--- a/tests/api_resources/test_brand.py
+++ b/tests/api_resources/test_brand.py
@@ -10,6 +10,7 @@
from brand.dev import BrandDev, AsyncBrandDev
from tests.utils import assert_matches_type
from brand.dev.types import (
+ BrandFontsResponse,
BrandAIQueryResponse,
BrandPrefetchResponse,
BrandRetrieveResponse,
@@ -154,6 +155,49 @@ def test_streaming_response_ai_query(self, client: BrandDev) -> None:
assert cast(Any, response.is_closed) is True
+ @pytest.mark.skip(reason="Prism tests are disabled")
+ @parametrize
+ def test_method_fonts(self, client: BrandDev) -> None:
+ brand = client.brand.fonts(
+ domain="domain",
+ )
+ assert_matches_type(BrandFontsResponse, brand, path=["response"])
+
+ @pytest.mark.skip(reason="Prism tests are disabled")
+ @parametrize
+ def test_method_fonts_with_all_params(self, client: BrandDev) -> None:
+ brand = client.brand.fonts(
+ domain="domain",
+ timeout_ms=1,
+ )
+ assert_matches_type(BrandFontsResponse, brand, path=["response"])
+
+ @pytest.mark.skip(reason="Prism tests are disabled")
+ @parametrize
+ def test_raw_response_fonts(self, client: BrandDev) -> None:
+ response = client.brand.with_raw_response.fonts(
+ domain="domain",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ brand = response.parse()
+ assert_matches_type(BrandFontsResponse, brand, path=["response"])
+
+ @pytest.mark.skip(reason="Prism tests are disabled")
+ @parametrize
+ def test_streaming_response_fonts(self, client: BrandDev) -> None:
+ with client.brand.with_streaming_response.fonts(
+ domain="domain",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ brand = response.parse()
+ assert_matches_type(BrandFontsResponse, brand, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
@pytest.mark.skip(reason="Prism tests are disabled")
@parametrize
def test_method_identify_from_transaction(self, client: BrandDev) -> None:
@@ -731,6 +775,49 @@ async def test_streaming_response_ai_query(self, async_client: AsyncBrandDev) ->
assert cast(Any, response.is_closed) is True
+ @pytest.mark.skip(reason="Prism tests are disabled")
+ @parametrize
+ async def test_method_fonts(self, async_client: AsyncBrandDev) -> None:
+ brand = await async_client.brand.fonts(
+ domain="domain",
+ )
+ assert_matches_type(BrandFontsResponse, brand, path=["response"])
+
+ @pytest.mark.skip(reason="Prism tests are disabled")
+ @parametrize
+ async def test_method_fonts_with_all_params(self, async_client: AsyncBrandDev) -> None:
+ brand = await async_client.brand.fonts(
+ domain="domain",
+ timeout_ms=1,
+ )
+ assert_matches_type(BrandFontsResponse, brand, path=["response"])
+
+ @pytest.mark.skip(reason="Prism tests are disabled")
+ @parametrize
+ async def test_raw_response_fonts(self, async_client: AsyncBrandDev) -> None:
+ response = await async_client.brand.with_raw_response.fonts(
+ domain="domain",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ brand = await response.parse()
+ assert_matches_type(BrandFontsResponse, brand, path=["response"])
+
+ @pytest.mark.skip(reason="Prism tests are disabled")
+ @parametrize
+ async def test_streaming_response_fonts(self, async_client: AsyncBrandDev) -> None:
+ async with async_client.brand.with_streaming_response.fonts(
+ domain="domain",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ brand = await response.parse()
+ assert_matches_type(BrandFontsResponse, brand, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
@pytest.mark.skip(reason="Prism tests are disabled")
@parametrize
async def test_method_identify_from_transaction(self, async_client: AsyncBrandDev) -> None:
From d49bf00625a4e5abc030ec5608af9ffe32cd6449 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 29 Nov 2025 20:55:58 +0000
Subject: [PATCH 5/5] release: 1.23.0
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 18 ++++++++++++++++++
pyproject.toml | 2 +-
src/brand/dev/_version.py | 2 +-
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 397c420..cdcf20e 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "1.22.0"
+ ".": "1.23.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index befd488..dc9a3ea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,23 @@
# Changelog
+## 1.23.0 (2025-11-29)
+
+Full Changelog: [v1.22.0...v1.23.0](https://github.com/brand-dot-dev/python-sdk/compare/v1.22.0...v1.23.0)
+
+### Features
+
+* **api:** manual updates ([d95285a](https://github.com/brand-dot-dev/python-sdk/commit/d95285ae339e8df4d50e793e7c9938ac226974f1))
+
+
+### Bug Fixes
+
+* ensure streams are always closed ([77df827](https://github.com/brand-dot-dev/python-sdk/commit/77df827c2608b4326d707c0ecbc93d7ec83957d5))
+
+
+### Chores
+
+* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([eedd772](https://github.com/brand-dot-dev/python-sdk/commit/eedd772cb757bcff196b6ed21ac9e887b8423fe0))
+
## 1.22.0 (2025-11-24)
Full Changelog: [v1.21.0...v1.22.0](https://github.com/brand-dot-dev/python-sdk/compare/v1.21.0...v1.22.0)
diff --git a/pyproject.toml b/pyproject.toml
index 5c9736d..611985f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "brand.dev"
-version = "1.22.0"
+version = "1.23.0"
description = "The official Python library for the brand.dev API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/brand/dev/_version.py b/src/brand/dev/_version.py
index 76c32a4..0745ee5 100644
--- a/src/brand/dev/_version.py
+++ b/src/brand/dev/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "brand.dev"
-__version__ = "1.22.0" # x-release-please-version
+__version__ = "1.23.0" # x-release-please-version