From 6551087fbe4480228ebfd967674eddf89c006684 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 23 Feb 2026 03:22:17 +0000 Subject: [PATCH 1/2] feat(api): manual updates --- .stats.yml | 2 +- README.md | 6 +-- src/cas_parser/__init__.py | 2 - src/cas_parser/_client.py | 83 ++++++-------------------------------- tests/test_client.py | 24 ----------- 5 files changed, 14 insertions(+), 103 deletions(-) diff --git a/.stats.yml b/.stats.yml index 49508b3..603f57a 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/cas-parser%2Fcas-parser-d9763d006969b49a1473851069fdfa429eb13133b64103a62963bb70ddb22305.yml openapi_spec_hash: 6aee689b7a759b12c85c088c15e29bc0 -config_hash: 4ab3e1ee76a463e0ed214541260ee12e +config_hash: 5509bb7a961ae2e79114b24c381606d4 diff --git a/README.md b/README.md index f7b645a..2a98af8 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Use the Cas Parser MCP Server to enable AI assistants to interact with this API, ## Documentation -The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in). The full API of this library can be found in [api.md](api.md). +The REST API documentation can be found on [casparser.in](https://casparser.in/docs). The full API of this library can be found in [api.md](api.md). ## Installation @@ -39,8 +39,6 @@ from cas_parser import CasParser client = CasParser( api_key=os.environ.get("CAS_PARSER_API_KEY"), # This is the default and can be omitted - # or 'production' | 'environment_2'; defaults to "production". - environment="environment_1", ) response = client.credits.check() @@ -63,8 +61,6 @@ from cas_parser import AsyncCasParser client = AsyncCasParser( api_key=os.environ.get("CAS_PARSER_API_KEY"), # This is the default and can be omitted - # or 'production' | 'environment_2'; defaults to "production". - environment="environment_1", ) diff --git a/src/cas_parser/__init__.py b/src/cas_parser/__init__.py index a146f39..1e1d246 100644 --- a/src/cas_parser/__init__.py +++ b/src/cas_parser/__init__.py @@ -6,7 +6,6 @@ from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given from ._utils import file_from_path from ._client import ( - ENVIRONMENTS, Client, Stream, Timeout, @@ -74,7 +73,6 @@ "AsyncStream", "CasParser", "AsyncCasParser", - "ENVIRONMENTS", "file_from_path", "BaseModel", "DEFAULT_TIMEOUT", diff --git a/src/cas_parser/_client.py b/src/cas_parser/_client.py index e63f97f..ebe71c1 100644 --- a/src/cas_parser/_client.py +++ b/src/cas_parser/_client.py @@ -3,8 +3,8 @@ from __future__ import annotations import os -from typing import TYPE_CHECKING, Any, Dict, Mapping, cast -from typing_extensions import Self, Literal, override +from typing import TYPE_CHECKING, Any, Mapping +from typing_extensions import Self, override import httpx @@ -59,7 +59,6 @@ from .resources.inbound_email import InboundEmailResource, AsyncInboundEmailResource __all__ = [ - "ENVIRONMENTS", "Timeout", "Transport", "ProxiesTypes", @@ -70,25 +69,16 @@ "AsyncClient", ] -ENVIRONMENTS: Dict[str, str] = { - "production": "https://portfolio-parser.api.casparser.in", - "environment_1": "https://client-apis.casparser.in", - "environment_2": "http://localhost:5000", -} - class CasParser(SyncAPIClient): # client options api_key: str - _environment: Literal["production", "environment_1", "environment_2"] | NotGiven - def __init__( self, *, api_key: str | None = None, - environment: Literal["production", "environment_1", "environment_2"] | NotGiven = not_given, - base_url: str | httpx.URL | None | NotGiven = not_given, + base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, @@ -119,31 +109,10 @@ def __init__( ) self.api_key = api_key - self._environment = environment - - base_url_env = os.environ.get("CAS_PARSER_BASE_URL") - if is_given(base_url) and base_url is not None: - # cast required because mypy doesn't understand the type narrowing - base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast] - elif is_given(environment): - if base_url_env and base_url is not None: - raise ValueError( - "Ambiguous URL; The `CAS_PARSER_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None", - ) - - try: - base_url = ENVIRONMENTS[environment] - except KeyError as exc: - raise ValueError(f"Unknown environment: {environment}") from exc - elif base_url_env is not None: - base_url = base_url_env - else: - self._environment = environment = "production" - - try: - base_url = ENVIRONMENTS[environment] - except KeyError as exc: - raise ValueError(f"Unknown environment: {environment}") from exc + if base_url is None: + base_url = os.environ.get("CAS_PARSER_BASE_URL") + if base_url is None: + base_url = f"https://api.casparser.in" super().__init__( version=__version__, @@ -260,7 +229,6 @@ def copy( self, *, api_key: str | None = None, - environment: Literal["production", "environment_1", "environment_2"] | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, @@ -296,7 +264,6 @@ def copy( return self.__class__( api_key=api_key or self.api_key, base_url=base_url or self.base_url, - environment=environment or self._environment, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, @@ -347,14 +314,11 @@ class AsyncCasParser(AsyncAPIClient): # client options api_key: str - _environment: Literal["production", "environment_1", "environment_2"] | NotGiven - def __init__( self, *, api_key: str | None = None, - environment: Literal["production", "environment_1", "environment_2"] | NotGiven = not_given, - base_url: str | httpx.URL | None | NotGiven = not_given, + base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, @@ -385,31 +349,10 @@ def __init__( ) self.api_key = api_key - self._environment = environment - - base_url_env = os.environ.get("CAS_PARSER_BASE_URL") - if is_given(base_url) and base_url is not None: - # cast required because mypy doesn't understand the type narrowing - base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast] - elif is_given(environment): - if base_url_env and base_url is not None: - raise ValueError( - "Ambiguous URL; The `CAS_PARSER_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None", - ) - - try: - base_url = ENVIRONMENTS[environment] - except KeyError as exc: - raise ValueError(f"Unknown environment: {environment}") from exc - elif base_url_env is not None: - base_url = base_url_env - else: - self._environment = environment = "production" - - try: - base_url = ENVIRONMENTS[environment] - except KeyError as exc: - raise ValueError(f"Unknown environment: {environment}") from exc + if base_url is None: + base_url = os.environ.get("CAS_PARSER_BASE_URL") + if base_url is None: + base_url = f"https://api.casparser.in" super().__init__( version=__version__, @@ -526,7 +469,6 @@ def copy( self, *, api_key: str | None = None, - environment: Literal["production", "environment_1", "environment_2"] | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, @@ -562,7 +504,6 @@ def copy( return self.__class__( api_key=api_key or self.api_key, base_url=base_url or self.base_url, - environment=environment or self._environment, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, diff --git a/tests/test_client.py b/tests/test_client.py index 5a768aa..ec19747 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -691,18 +691,6 @@ def test_base_url_env(self) -> None: client = CasParser(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" - # explicit environment arg requires explicitness - with update_env(CAS_PARSER_BASE_URL="http://localhost:5000/from/env"): - with pytest.raises(ValueError, match=r"you must pass base_url=None"): - CasParser(api_key=api_key, _strict_response_validation=True, environment="production") - - client = CasParser( - base_url=None, api_key=api_key, _strict_response_validation=True, environment="production" - ) - assert str(client.base_url).startswith("https://portfolio-parser.api.casparser.in") - - client.close() - @pytest.mark.parametrize( "client", [ @@ -1592,18 +1580,6 @@ async def test_base_url_env(self) -> None: client = AsyncCasParser(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" - # explicit environment arg requires explicitness - with update_env(CAS_PARSER_BASE_URL="http://localhost:5000/from/env"): - with pytest.raises(ValueError, match=r"you must pass base_url=None"): - AsyncCasParser(api_key=api_key, _strict_response_validation=True, environment="production") - - client = AsyncCasParser( - base_url=None, api_key=api_key, _strict_response_validation=True, environment="production" - ) - assert str(client.base_url).startswith("https://portfolio-parser.api.casparser.in") - - await client.close() - @pytest.mark.parametrize( "client", [ From 1f419dd313162417af8478be544fc702e4d208b2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 23 Feb 2026 03:22:30 +0000 Subject: [PATCH 2/2] release: 1.6.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/cas_parser/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fbd9082..7deae33 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.5.0" + ".": "1.6.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fe0243..5d7b570 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.6.0 (2026-02-23) + +Full Changelog: [v1.5.0...v1.6.0](https://github.com/CASParser/cas-parser-python/compare/v1.5.0...v1.6.0) + +### Features + +* **api:** manual updates ([6551087](https://github.com/CASParser/cas-parser-python/commit/6551087fbe4480228ebfd967674eddf89c006684)) + ## 1.5.0 (2026-02-23) Full Changelog: [v1.4.1...v1.5.0](https://github.com/CASParser/cas-parser-python/compare/v1.4.1...v1.5.0) diff --git a/pyproject.toml b/pyproject.toml index 4e79dc8..85106e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cas-parser-python" -version = "1.5.0" +version = "1.6.0" description = "The official Python library for the cas-parser API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/cas_parser/_version.py b/src/cas_parser/_version.py index e73e451..1d9ca9a 100644 --- a/src/cas_parser/_version.py +++ b/src/cas_parser/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "cas_parser" -__version__ = "1.5.0" # x-release-please-version +__version__ = "1.6.0" # x-release-please-version