diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f7014c3..a713055 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.11.0" + ".": "0.12.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c721828..6d33ce6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 21 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-18bb184b75673248917773c4c074813ca4bd966458b2f039b937df63209c029d.yml -openapi_spec_hash: ef79dd2063dd500127748ee843f5e783 -config_hash: 7d13dca2b2c6f71fc463cb6062efa5ea +configured_endpoints: 22 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-a831ece9950c336fba69327e01aed391a08418e1898f4aff27a800471f139cc7.yml +openapi_spec_hash: 459258410b739536cdc75b91e8b4eac7 +config_hash: 70354330f92ce169beabc98696ebb9a3 diff --git a/CHANGELOG.md b/CHANGELOG.md index bd55d58..a982e33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.12.0 (2026-04-25) + +Full Changelog: [v0.11.0...v0.12.0](https://github.com/context-dot-dev/context-python-sdk/compare/v0.11.0...v0.12.0) + +### Features + +* **api:** manual updates ([985bdda](https://github.com/context-dot-dev/context-python-sdk/commit/985bdda494fb493203a3b1db746c5c00c63199d1)) + ## 0.11.0 (2026-04-24) Full Changelog: [v0.10.0...v0.11.0](https://github.com/context-dot-dev/context-python-sdk/compare/v0.10.0...v0.11.0) diff --git a/api.md b/api.md index 963807e..3dd9e9a 100644 --- a/api.md +++ b/api.md @@ -71,12 +71,13 @@ Methods: Types: ```python -from context.dev.types import IndustryRetrieveNaicsResponse +from context.dev.types import IndustryRetrieveNaicsResponse, IndustryRetrieveSicResponse ``` Methods: - client.industry.retrieve_naics(\*\*params) -> IndustryRetrieveNaicsResponse +- client.industry.retrieve_sic(\*\*params) -> IndustryRetrieveSicResponse # Utility diff --git a/pyproject.toml b/pyproject.toml index c2a69b4..acf5906 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "context.dev" -version = "0.11.0" +version = "0.12.0" description = "The official Python library for the context.dev API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/context/dev/_version.py b/src/context/dev/_version.py index 636e3c7..b052e1c 100644 --- a/src/context/dev/_version.py +++ b/src/context/dev/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "context.dev" -__version__ = "0.11.0" # x-release-please-version +__version__ = "0.12.0" # x-release-please-version diff --git a/src/context/dev/resources/industry.py b/src/context/dev/resources/industry.py index 73c96ac..fbcce05 100644 --- a/src/context/dev/resources/industry.py +++ b/src/context/dev/resources/industry.py @@ -2,9 +2,11 @@ from __future__ import annotations +from typing_extensions import Literal + import httpx -from ..types import industry_retrieve_naics_params +from ..types import industry_retrieve_sic_params, industry_retrieve_naics_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property @@ -16,6 +18,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options +from ..types.industry_retrieve_sic_response import IndustryRetrieveSicResponse from ..types.industry_retrieve_naics_response import IndustryRetrieveNaicsResponse __all__ = ["IndustryResource", "AsyncIndustryResource"] @@ -100,6 +103,72 @@ def retrieve_naics( cast_to=IndustryRetrieveNaicsResponse, ) + def retrieve_sic( + self, + *, + input: str, + max_results: int | Omit = omit, + min_results: int | Omit = omit, + timeout_ms: int | Omit = omit, + type: Literal["original_sic", "latest_sec"] | 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, + ) -> IndustryRetrieveSicResponse: + """ + Classify any brand into Standard Industrial Classification (SIC) codes from its + domain or name. Choose between the original 1987 SIC system (`original_sic`) or + the latest SIC list maintained by the SEC (`latest_sec`). + + Args: + input: Brand domain or title to retrieve SIC code for. If a valid domain is provided, + it will be used for classification, otherwise, we will search for the brand + using the provided title. + + max_results: Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + + min_results: Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + + 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). + + type: Which SIC dataset to classify against. `original_sic` uses the 1987 Standard + Industrial Classification system; `latest_sec` uses the current SIC list as + published by the SEC. Defaults to `original_sic`. + + 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( + "/web/sic", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "input": input, + "max_results": max_results, + "min_results": min_results, + "timeout_ms": timeout_ms, + "type": type, + }, + industry_retrieve_sic_params.IndustryRetrieveSicParams, + ), + ), + cast_to=IndustryRetrieveSicResponse, + ) + class AsyncIndustryResource(AsyncAPIResource): @cached_property @@ -180,6 +249,72 @@ async def retrieve_naics( cast_to=IndustryRetrieveNaicsResponse, ) + async def retrieve_sic( + self, + *, + input: str, + max_results: int | Omit = omit, + min_results: int | Omit = omit, + timeout_ms: int | Omit = omit, + type: Literal["original_sic", "latest_sec"] | 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, + ) -> IndustryRetrieveSicResponse: + """ + Classify any brand into Standard Industrial Classification (SIC) codes from its + domain or name. Choose between the original 1987 SIC system (`original_sic`) or + the latest SIC list maintained by the SEC (`latest_sec`). + + Args: + input: Brand domain or title to retrieve SIC code for. If a valid domain is provided, + it will be used for classification, otherwise, we will search for the brand + using the provided title. + + max_results: Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + + min_results: Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + + 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). + + type: Which SIC dataset to classify against. `original_sic` uses the 1987 Standard + Industrial Classification system; `latest_sec` uses the current SIC list as + published by the SEC. Defaults to `original_sic`. + + 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( + "/web/sic", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "input": input, + "max_results": max_results, + "min_results": min_results, + "timeout_ms": timeout_ms, + "type": type, + }, + industry_retrieve_sic_params.IndustryRetrieveSicParams, + ), + ), + cast_to=IndustryRetrieveSicResponse, + ) + class IndustryResourceWithRawResponse: def __init__(self, industry: IndustryResource) -> None: @@ -188,6 +323,9 @@ def __init__(self, industry: IndustryResource) -> None: self.retrieve_naics = to_raw_response_wrapper( industry.retrieve_naics, ) + self.retrieve_sic = to_raw_response_wrapper( + industry.retrieve_sic, + ) class AsyncIndustryResourceWithRawResponse: @@ -197,6 +335,9 @@ def __init__(self, industry: AsyncIndustryResource) -> None: self.retrieve_naics = async_to_raw_response_wrapper( industry.retrieve_naics, ) + self.retrieve_sic = async_to_raw_response_wrapper( + industry.retrieve_sic, + ) class IndustryResourceWithStreamingResponse: @@ -206,6 +347,9 @@ def __init__(self, industry: IndustryResource) -> None: self.retrieve_naics = to_streamed_response_wrapper( industry.retrieve_naics, ) + self.retrieve_sic = to_streamed_response_wrapper( + industry.retrieve_sic, + ) class AsyncIndustryResourceWithStreamingResponse: @@ -215,3 +359,6 @@ def __init__(self, industry: AsyncIndustryResource) -> None: self.retrieve_naics = async_to_streamed_response_wrapper( industry.retrieve_naics, ) + self.retrieve_sic = async_to_streamed_response_wrapper( + industry.retrieve_sic, + ) diff --git a/src/context/dev/types/__init__.py b/src/context/dev/types/__init__.py index 232daf5..60c8ac7 100644 --- a/src/context/dev/types/__init__.py +++ b/src/context/dev/types/__init__.py @@ -21,6 +21,7 @@ from .web_web_scrape_md_response import WebWebScrapeMdResponse as WebWebScrapeMdResponse from .ai_extract_product_response import AIExtractProductResponse as AIExtractProductResponse from .ai_extract_products_response import AIExtractProductsResponse as AIExtractProductsResponse +from .industry_retrieve_sic_params import IndustryRetrieveSicParams as IndustryRetrieveSicParams from .web_web_scrape_html_response import WebWebScrapeHTMLResponse as WebWebScrapeHTMLResponse from .web_web_scrape_images_params import WebWebScrapeImagesParams as WebWebScrapeImagesParams from .brand_retrieve_by_isin_params import BrandRetrieveByIsinParams as BrandRetrieveByIsinParams @@ -29,6 +30,7 @@ from .web_web_scrape_sitemap_params import WebWebScrapeSitemapParams as WebWebScrapeSitemapParams from .brand_retrieve_by_email_params import BrandRetrieveByEmailParams as BrandRetrieveByEmailParams from .industry_retrieve_naics_params import IndustryRetrieveNaicsParams as IndustryRetrieveNaicsParams +from .industry_retrieve_sic_response import IndustryRetrieveSicResponse as IndustryRetrieveSicResponse from .web_web_scrape_images_response import WebWebScrapeImagesResponse as WebWebScrapeImagesResponse from .brand_retrieve_by_isin_response import BrandRetrieveByIsinResponse as BrandRetrieveByIsinResponse from .brand_retrieve_by_name_response import BrandRetrieveByNameResponse as BrandRetrieveByNameResponse diff --git a/src/context/dev/types/industry_retrieve_sic_params.py b/src/context/dev/types/industry_retrieve_sic_params.py new file mode 100644 index 0000000..2d9e23d --- /dev/null +++ b/src/context/dev/types/industry_retrieve_sic_params.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["IndustryRetrieveSicParams"] + + +class IndustryRetrieveSicParams(TypedDict, total=False): + input: Required[str] + """Brand domain or title to retrieve SIC code for. + + If a valid domain is provided, it will be used for classification, otherwise, we + will search for the brand using the provided title. + """ + + max_results: Annotated[int, PropertyInfo(alias="maxResults")] + """Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5.""" + + min_results: Annotated[int, PropertyInfo(alias="minResults")] + """Minimum number of SIC codes to return. Must be at least 1. Defaults to 1.""" + + 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). + """ + + type: Literal["original_sic", "latest_sec"] + """Which SIC dataset to classify against. + + `original_sic` uses the 1987 Standard Industrial Classification system; + `latest_sec` uses the current SIC list as published by the SEC. Defaults to + `original_sic`. + """ diff --git a/src/context/dev/types/industry_retrieve_sic_response.py b/src/context/dev/types/industry_retrieve_sic_response.py new file mode 100644 index 0000000..9a72bb6 --- /dev/null +++ b/src/context/dev/types/industry_retrieve_sic_response.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["IndustryRetrieveSicResponse", "Code"] + + +class Code(BaseModel): + code: str + """SIC code (4-digit).""" + + confidence: Literal["high", "medium", "low"] + """Confidence level for how well this SIC code matches the company description.""" + + name: str + """SIC industry title.""" + + major_group: Optional[str] = FieldInfo(alias="majorGroup", default=None) + """2-digit major group identifier (the leading two digits of the code). + + Only present when `classification` is `original_sic`. + """ + + major_group_name: Optional[str] = FieldInfo(alias="majorGroupName", default=None) + """Description of the 2-digit major group. + + Only present when `classification` is `original_sic`. + """ + + office: Optional[str] = None + """SEC review office responsible for filings under this code. + + Only present when `classification` is `latest_sec`. + """ + + +class IndustryRetrieveSicResponse(BaseModel): + classification: Optional[Literal["original_sic", "latest_sec"]] = None + """Echoes back which SIC dataset was used to classify the brand.""" + + codes: Optional[List[Code]] = None + """Array of SIC codes with confidence scores. + + Extra fields depend on the requested classification: `original_sic` results + include `majorGroup` and `majorGroupName`; `latest_sec` results include + `office`. + """ + + domain: Optional[str] = None + """Domain found for the brand""" + + status: Optional[str] = None + """Status of the response, e.g., 'ok'""" + + type: Optional[str] = None + """Industry classification type, for sic api it will be `sic`""" diff --git a/tests/api_resources/test_industry.py b/tests/api_resources/test_industry.py index 543c358..047d428 100644 --- a/tests/api_resources/test_industry.py +++ b/tests/api_resources/test_industry.py @@ -9,7 +9,10 @@ from context.dev import ContextDev, AsyncContextDev from tests.utils import assert_matches_type -from context.dev.types import IndustryRetrieveNaicsResponse +from context.dev.types import ( + IndustryRetrieveSicResponse, + IndustryRetrieveNaicsResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -62,6 +65,52 @@ def test_streaming_response_retrieve_naics(self, client: ContextDev) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve_sic(self, client: ContextDev) -> None: + industry = client.industry.retrieve_sic( + input="input", + ) + assert_matches_type(IndustryRetrieveSicResponse, industry, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_retrieve_sic_with_all_params(self, client: ContextDev) -> None: + industry = client.industry.retrieve_sic( + input="input", + max_results=1, + min_results=1, + timeout_ms=1000, + type="original_sic", + ) + assert_matches_type(IndustryRetrieveSicResponse, industry, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_retrieve_sic(self, client: ContextDev) -> None: + response = client.industry.with_raw_response.retrieve_sic( + input="input", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + industry = response.parse() + assert_matches_type(IndustryRetrieveSicResponse, industry, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_retrieve_sic(self, client: ContextDev) -> None: + with client.industry.with_streaming_response.retrieve_sic( + input="input", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + industry = response.parse() + assert_matches_type(IndustryRetrieveSicResponse, industry, path=["response"]) + + assert cast(Any, response.is_closed) is True + class TestAsyncIndustry: parametrize = pytest.mark.parametrize( @@ -112,3 +161,49 @@ async def test_streaming_response_retrieve_naics(self, async_client: AsyncContex assert_matches_type(IndustryRetrieveNaicsResponse, industry, path=["response"]) assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve_sic(self, async_client: AsyncContextDev) -> None: + industry = await async_client.industry.retrieve_sic( + input="input", + ) + assert_matches_type(IndustryRetrieveSicResponse, industry, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_retrieve_sic_with_all_params(self, async_client: AsyncContextDev) -> None: + industry = await async_client.industry.retrieve_sic( + input="input", + max_results=1, + min_results=1, + timeout_ms=1000, + type="original_sic", + ) + assert_matches_type(IndustryRetrieveSicResponse, industry, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_retrieve_sic(self, async_client: AsyncContextDev) -> None: + response = await async_client.industry.with_raw_response.retrieve_sic( + input="input", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + industry = await response.parse() + assert_matches_type(IndustryRetrieveSicResponse, industry, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_retrieve_sic(self, async_client: AsyncContextDev) -> None: + async with async_client.industry.with_streaming_response.retrieve_sic( + input="input", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + industry = await response.parse() + assert_matches_type(IndustryRetrieveSicResponse, industry, path=["response"]) + + assert cast(Any, response.is_closed) is True