diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b429f966..db00cae0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.66.0" + ".": "0.67.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 5ad69241..a1640098 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 119 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-e66c3f8aedccc39104386a3ec619f3fdcef7e8b00d9e5aa82e414a1b387351c2.yml -openapi_spec_hash: afeddf18ebc3da1521b3e6f6739411fa -config_hash: 80eef1b592110714ea55cd26c470fabb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-51549f813f3002e18c6ca8d850cc0c7932828d511c151e0412c73b6798d19e30.yml +openapi_spec_hash: ee77b293c4bda91c1a32cfdd12b8739e +config_hash: 57567e00b41af47cef1b78e51b747aa0 diff --git a/CHANGELOG.md b/CHANGELOG.md index af41d8db..342bd471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.67.0 (2026-06-11) + +Full Changelog: [v0.66.0...v0.67.0](https://github.com/kernel/kernel-python-sdk/compare/v0.66.0...v0.67.0) + +### Features + +* Add project_id SDK client option mapped to X-Kernel-Project-Id ([1799732](https://github.com/kernel/kernel-python-sdk/commit/17997322232374c6c49d99333b564a0537f247c0)) + + +### Documentation + +* **api:** correct project-scoping descriptions in OpenAPI spec ([5929332](https://github.com/kernel/kernel-python-sdk/commit/592933283ff7bf0e6596ddbfbc4851e285a1d36e)) + ## 0.66.0 (2026-06-10) Full Changelog: [v0.65.0...v0.66.0](https://github.com/kernel/kernel-python-sdk/compare/v0.65.0...v0.66.0) diff --git a/pyproject.toml b/pyproject.toml index c9fef2a6..035e174c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "kernel" -version = "0.66.0" +version = "0.67.0" description = "The official Python library for the kernel API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/kernel/_client.py b/src/kernel/_client.py index 5e7e5e0d..977b83d1 100644 --- a/src/kernel/_client.py +++ b/src/kernel/_client.py @@ -100,6 +100,8 @@ class Kernel(SyncAPIClient): api_key: str browser_route_cache: BrowserRouteCache + project_id: str | None + _environment: Literal["production", "development"] | NotGiven _browser_routing: BrowserRoutingConfig @@ -107,6 +109,7 @@ def __init__( self, *, api_key: str | None = None, + project_id: str | None = None, environment: Literal["production", "development"] | NotGiven = not_given, base_url: str | httpx.URL | None | NotGiven = not_given, timeout: float | Timeout | None | NotGiven = not_given, @@ -140,6 +143,8 @@ def __init__( ) self.api_key = api_key + self.project_id = project_id + self._environment = environment base_url_env = os.environ.get("KERNEL_BASE_URL") @@ -309,6 +314,7 @@ def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, "X-Stainless-Async": "false", + "X-Kernel-Project-Id": self.project_id if self.project_id is not None else Omit(), **self._custom_headers, } @@ -347,6 +353,7 @@ def copy( self, *, api_key: str | None = None, + project_id: str | None = None, environment: Literal["production", "development"] | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, @@ -383,6 +390,7 @@ def copy( http_client = http_client or self._client return self.__class__( api_key=api_key or self.api_key, + project_id=project_id or self.project_id, base_url=base_url or self.base_url, environment=environment or self._environment, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, @@ -437,6 +445,8 @@ class AsyncKernel(AsyncAPIClient): api_key: str browser_route_cache: BrowserRouteCache + project_id: str | None + _environment: Literal["production", "development"] | NotGiven _browser_routing: BrowserRoutingConfig @@ -444,6 +454,7 @@ def __init__( self, *, api_key: str | None = None, + project_id: str | None = None, environment: Literal["production", "development"] | NotGiven = not_given, base_url: str | httpx.URL | None | NotGiven = not_given, timeout: float | Timeout | None | NotGiven = not_given, @@ -477,6 +488,8 @@ def __init__( ) self.api_key = api_key + self.project_id = project_id + self._environment = environment base_url_env = os.environ.get("KERNEL_BASE_URL") @@ -646,6 +659,7 @@ def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, "X-Stainless-Async": f"async:{get_async_library()}", + "X-Kernel-Project-Id": self.project_id if self.project_id is not None else Omit(), **self._custom_headers, } @@ -684,6 +698,7 @@ def copy( self, *, api_key: str | None = None, + project_id: str | None = None, environment: Literal["production", "development"] | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, @@ -720,6 +735,7 @@ def copy( http_client = http_client or self._client return self.__class__( api_key=api_key or self.api_key, + project_id=project_id or self.project_id, base_url=base_url or self.base_url, environment=environment or self._environment, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, diff --git a/src/kernel/_version.py b/src/kernel/_version.py index eda0bdfb..7c28de48 100644 --- a/src/kernel/_version.py +++ b/src/kernel/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "kernel" -__version__ = "0.66.0" # x-release-please-version +__version__ = "0.67.0" # x-release-please-version diff --git a/src/kernel/resources/auth/connections.py b/src/kernel/resources/auth/connections.py index dc912aba..362e6129 100644 --- a/src/kernel/resources/auth/connections.py +++ b/src/kernel/resources/auth/connections.py @@ -136,8 +136,8 @@ def create( login_url: Optional login page URL to skip discovery - proxy: Proxy selection. Provide either id or name. The proxy must belong to the - caller's org. + proxy: Proxy selection. Provide either id or name. The proxy must be in the same + project as the resource referencing it. record_session: Whether to record browser sessions for this connection by default. Useful for debugging. Can be overridden per-login. Defaults to false. @@ -264,8 +264,8 @@ def update( login_url: Login page URL. Set to empty string to clear. - proxy: Proxy selection. Provide either id or name. The proxy must belong to the - caller's org. + proxy: Proxy selection. Provide either id or name. The proxy must be in the same + project as the resource referencing it. record_session: Whether to record browser sessions for this connection by default @@ -457,8 +457,8 @@ def login( credentials are stored. Args: - proxy: Proxy selection. Provide either id or name. The proxy must belong to the - caller's org. + proxy: Proxy selection. Provide either id or name. The proxy must be in the same + project as the resource referencing it. record_session: Override the connection's default for recording this login's browser session. When omitted, the connection's record_session default is used. @@ -653,8 +653,8 @@ async def create( login_url: Optional login page URL to skip discovery - proxy: Proxy selection. Provide either id or name. The proxy must belong to the - caller's org. + proxy: Proxy selection. Provide either id or name. The proxy must be in the same + project as the resource referencing it. record_session: Whether to record browser sessions for this connection by default. Useful for debugging. Can be overridden per-login. Defaults to false. @@ -781,8 +781,8 @@ async def update( login_url: Login page URL. Set to empty string to clear. - proxy: Proxy selection. Provide either id or name. The proxy must belong to the - caller's org. + proxy: Proxy selection. Provide either id or name. The proxy must be in the same + project as the resource referencing it. record_session: Whether to record browser sessions for this connection by default @@ -974,8 +974,8 @@ async def login( credentials are stored. Args: - proxy: Proxy selection. Provide either id or name. The proxy must belong to the - caller's org. + proxy: Proxy selection. Provide either id or name. The proxy must be in the same + project as the resource referencing it. record_session: Override the connection's default for recording this login's browser session. When omitted, the connection's record_session default is used. diff --git a/src/kernel/resources/browser_pools.py b/src/kernel/resources/browser_pools.py index 5099f446..fc32c951 100644 --- a/src/kernel/resources/browser_pools.py +++ b/src/kernel/resources/browser_pools.py @@ -109,8 +109,8 @@ def create( specified, the matching profile will be loaded into the browser session. Profiles must be created beforehand. - proxy_id: Optional proxy to associate to the browser session. Must reference a proxy - belonging to the caller's org. + proxy_id: Optional proxy to associate to the browser session. Must reference a proxy in + the same project as the browser session. start_url: Optional URL to navigate to when a new browser is warmed into the pool. Best-effort: failures to navigate do not fail pool fill. Only applied to @@ -256,8 +256,8 @@ def update( specified, the matching profile will be loaded into the browser session. Profiles must be created beforehand. - proxy_id: Optional proxy to associate to the browser session. Must reference a proxy - belonging to the caller's org. + proxy_id: Optional proxy to associate to the browser session. Must reference a proxy in + the same project as the browser session. size: Number of browsers to maintain in the pool. The maximum size is determined by your organization's pooled sessions limit (the sum of all pool sizes cannot @@ -338,7 +338,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPagination[BrowserPool]: """ - List browser pools owned by the caller's organization. + List browser pools in the resolved project. Args: limit: Limit the number of browser pools to return. @@ -630,8 +630,8 @@ async def create( specified, the matching profile will be loaded into the browser session. Profiles must be created beforehand. - proxy_id: Optional proxy to associate to the browser session. Must reference a proxy - belonging to the caller's org. + proxy_id: Optional proxy to associate to the browser session. Must reference a proxy in + the same project as the browser session. start_url: Optional URL to navigate to when a new browser is warmed into the pool. Best-effort: failures to navigate do not fail pool fill. Only applied to @@ -777,8 +777,8 @@ async def update( specified, the matching profile will be loaded into the browser session. Profiles must be created beforehand. - proxy_id: Optional proxy to associate to the browser session. Must reference a proxy - belonging to the caller's org. + proxy_id: Optional proxy to associate to the browser session. Must reference a proxy in + the same project as the browser session. size: Number of browsers to maintain in the pool. The maximum size is determined by your organization's pooled sessions limit (the sum of all pool sizes cannot @@ -859,7 +859,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[BrowserPool, AsyncOffsetPagination[BrowserPool]]: """ - List browser pools owned by the caller's organization. + List browser pools in the resolved project. Args: limit: Limit the number of browser pools to return. diff --git a/src/kernel/resources/browsers/browsers.py b/src/kernel/resources/browsers/browsers.py index c5c365e6..a5564b84 100644 --- a/src/kernel/resources/browsers/browsers.py +++ b/src/kernel/resources/browsers/browsers.py @@ -216,8 +216,8 @@ def create( specified, the matching profile will be loaded into the browser session. Profiles must be created beforehand. - proxy_id: Optional proxy to associate to the browser session. Must reference a proxy - belonging to the caller's org. + proxy_id: Optional proxy to associate to the browser session. Must reference a proxy in + the same project as the browser session. start_url: Optional URL to open when the browser session is created. Navigation is best-effort, so navigation failures do not prevent the session from being @@ -794,8 +794,8 @@ async def create( specified, the matching profile will be loaded into the browser session. Profiles must be created beforehand. - proxy_id: Optional proxy to associate to the browser session. Must reference a proxy - belonging to the caller's org. + proxy_id: Optional proxy to associate to the browser session. Must reference a proxy in + the same project as the browser session. start_url: Optional URL to open when the browser session is created. Navigation is best-effort, so navigation failures do not prevent the session from being diff --git a/src/kernel/resources/credentials.py b/src/kernel/resources/credentials.py index 7d00faab..4c90ef85 100644 --- a/src/kernel/resources/credentials.py +++ b/src/kernel/resources/credentials.py @@ -212,10 +212,9 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPagination[Credential]: - """List credentials owned by the caller's organization. + """List credentials in the resolved project. - Credential values are not - returned. + Credential values are not returned. Args: domain: Filter by domain @@ -509,10 +508,9 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Credential, AsyncOffsetPagination[Credential]]: - """List credentials owned by the caller's organization. + """List credentials in the resolved project. - Credential values are not - returned. + Credential values are not returned. Args: domain: Filter by domain diff --git a/src/kernel/resources/extensions.py b/src/kernel/resources/extensions.py index 5b7215be..8d7acb14 100644 --- a/src/kernel/resources/extensions.py +++ b/src/kernel/resources/extensions.py @@ -70,7 +70,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPagination[ExtensionListResponse]: """ - List extensions owned by the caller's organization. + List extensions in the resolved project. Args: limit: Limit the number of extensions to return. @@ -308,7 +308,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ExtensionListResponse, AsyncOffsetPagination[ExtensionListResponse]]: """ - List extensions owned by the caller's organization. + List extensions in the resolved project. Args: limit: Limit the number of extensions to return. diff --git a/src/kernel/resources/proxies.py b/src/kernel/resources/proxies.py index 2239a854..831e7819 100644 --- a/src/kernel/resources/proxies.py +++ b/src/kernel/resources/proxies.py @@ -65,7 +65,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyCreateResponse: """ - Create a new proxy configuration for the caller's organization. + Create a new proxy configuration in the resolved project. Args: type: Proxy type to use. In terms of quality for avoiding bot-detection, from best to @@ -117,7 +117,7 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyRetrieveResponse: """ - Retrieve a proxy belonging to the caller's organization by ID. + Retrieve a proxy in the resolved project by ID. Args: extra_headers: Send extra headers @@ -151,7 +151,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPagination[ProxyListResponse]: """ - List proxies owned by the caller's organization. + List proxies in the resolved project. Args: limit: Limit the number of proxies to return. @@ -313,7 +313,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyCreateResponse: """ - Create a new proxy configuration for the caller's organization. + Create a new proxy configuration in the resolved project. Args: type: Proxy type to use. In terms of quality for avoiding bot-detection, from best to @@ -365,7 +365,7 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProxyRetrieveResponse: """ - Retrieve a proxy belonging to the caller's organization by ID. + Retrieve a proxy in the resolved project by ID. Args: extra_headers: Send extra headers @@ -399,7 +399,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ProxyListResponse, AsyncOffsetPagination[ProxyListResponse]]: """ - List proxies owned by the caller's organization. + List proxies in the resolved project. Args: limit: Limit the number of proxies to return. diff --git a/src/kernel/types/auth/connection_create_params.py b/src/kernel/types/auth/connection_create_params.py index acde944c..e5a969ce 100644 --- a/src/kernel/types/auth/connection_create_params.py +++ b/src/kernel/types/auth/connection_create_params.py @@ -83,7 +83,8 @@ class ConnectionCreateParams(TypedDict, total=False): proxy: Proxy """Proxy selection. - Provide either id or name. The proxy must belong to the caller's org. + Provide either id or name. The proxy must be in the same project as the resource + referencing it. """ record_session: bool @@ -124,7 +125,7 @@ class Credential(TypedDict, total=False): class Proxy(TypedDict, total=False): """Proxy selection. - Provide either id or name. The proxy must belong to the caller's org. + Provide either id or name. The proxy must be in the same project as the resource referencing it. """ id: str diff --git a/src/kernel/types/auth/connection_login_params.py b/src/kernel/types/auth/connection_login_params.py index 39756cb1..5e136cc3 100644 --- a/src/kernel/types/auth/connection_login_params.py +++ b/src/kernel/types/auth/connection_login_params.py @@ -11,7 +11,8 @@ class ConnectionLoginParams(TypedDict, total=False): proxy: Proxy """Proxy selection. - Provide either id or name. The proxy must belong to the caller's org. + Provide either id or name. The proxy must be in the same project as the resource + referencing it. """ record_session: bool @@ -24,7 +25,7 @@ class ConnectionLoginParams(TypedDict, total=False): class Proxy(TypedDict, total=False): """Proxy selection. - Provide either id or name. The proxy must belong to the caller's org. + Provide either id or name. The proxy must be in the same project as the resource referencing it. """ id: str diff --git a/src/kernel/types/auth/connection_update_params.py b/src/kernel/types/auth/connection_update_params.py index 8875f609..e0dadf70 100644 --- a/src/kernel/types/auth/connection_update_params.py +++ b/src/kernel/types/auth/connection_update_params.py @@ -50,7 +50,8 @@ class ConnectionUpdateParams(TypedDict, total=False): proxy: Proxy """Proxy selection. - Provide either id or name. The proxy must belong to the caller's org. + Provide either id or name. The proxy must be in the same project as the resource + referencing it. """ record_session: bool @@ -85,7 +86,7 @@ class Credential(TypedDict, total=False): class Proxy(TypedDict, total=False): """Proxy selection. - Provide either id or name. The proxy must belong to the caller's org. + Provide either id or name. The proxy must be in the same project as the resource referencing it. """ id: str diff --git a/src/kernel/types/browser_create_params.py b/src/kernel/types/browser_create_params.py index 01308f38..10d53936 100644 --- a/src/kernel/types/browser_create_params.py +++ b/src/kernel/types/browser_create_params.py @@ -67,7 +67,7 @@ class BrowserCreateParams(TypedDict, total=False): proxy_id: str """Optional proxy to associate to the browser session. - Must reference a proxy belonging to the caller's org. + Must reference a proxy in the same project as the browser session. """ start_url: str diff --git a/src/kernel/types/browser_pool.py b/src/kernel/types/browser_pool.py index 8ead6807..8ad50acf 100644 --- a/src/kernel/types/browser_pool.py +++ b/src/kernel/types/browser_pool.py @@ -60,7 +60,7 @@ class BrowserPoolConfig(BaseModel): proxy_id: Optional[str] = None """Optional proxy to associate to the browser session. - Must reference a proxy belonging to the caller's org. + Must reference a proxy in the same project as the browser session. """ start_url: Optional[str] = None diff --git a/src/kernel/types/browser_pool_create_params.py b/src/kernel/types/browser_pool_create_params.py index 1ffeeb75..33d04ce4 100644 --- a/src/kernel/types/browser_pool_create_params.py +++ b/src/kernel/types/browser_pool_create_params.py @@ -59,7 +59,7 @@ class BrowserPoolCreateParams(TypedDict, total=False): proxy_id: str """Optional proxy to associate to the browser session. - Must reference a proxy belonging to the caller's org. + Must reference a proxy in the same project as the browser session. """ start_url: str diff --git a/src/kernel/types/browser_pool_update_params.py b/src/kernel/types/browser_pool_update_params.py index 07501695..e80b5aa0 100644 --- a/src/kernel/types/browser_pool_update_params.py +++ b/src/kernel/types/browser_pool_update_params.py @@ -58,7 +58,7 @@ class BrowserPoolUpdateParams(TypedDict, total=False): proxy_id: str """Optional proxy to associate to the browser session. - Must reference a proxy belonging to the caller's org. + Must reference a proxy in the same project as the browser session. """ size: int