Skip to content

Commit 0468512

Browse files
Merge pull request #14 from CASParser/release-please--branches--main--changes--next
release: 1.6.0
2 parents b3f8f3a + 1f419dd commit 0468512

File tree

9 files changed

+25
-106
lines changed

9 files changed

+25
-106
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.5.0"
2+
".": "1.6.0"
33
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 21
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-d9763d006969b49a1473851069fdfa429eb13133b64103a62963bb70ddb22305.yml
33
openapi_spec_hash: 6aee689b7a759b12c85c088c15e29bc0
4-
config_hash: 4ab3e1ee76a463e0ed214541260ee12e
4+
config_hash: 5509bb7a961ae2e79114b24c381606d4

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 1.6.0 (2026-02-23)
4+
5+
Full Changelog: [v1.5.0...v1.6.0](https://github.com/CASParser/cas-parser-python/compare/v1.5.0...v1.6.0)
6+
7+
### Features
8+
9+
* **api:** manual updates ([6551087](https://github.com/CASParser/cas-parser-python/commit/6551087fbe4480228ebfd967674eddf89c006684))
10+
311
## 1.5.0 (2026-02-23)
412

513
Full Changelog: [v1.4.1...v1.5.0](https://github.com/CASParser/cas-parser-python/compare/v1.4.1...v1.5.0)

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Use the Cas Parser MCP Server to enable AI assistants to interact with this API,
2020
2121
## Documentation
2222

23-
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).
23+
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).
2424

2525
## Installation
2626

@@ -39,8 +39,6 @@ from cas_parser import CasParser
3939

4040
client = CasParser(
4141
api_key=os.environ.get("CAS_PARSER_API_KEY"), # This is the default and can be omitted
42-
# or 'production' | 'environment_2'; defaults to "production".
43-
environment="environment_1",
4442
)
4543

4644
response = client.credits.check()
@@ -63,8 +61,6 @@ from cas_parser import AsyncCasParser
6361

6462
client = AsyncCasParser(
6563
api_key=os.environ.get("CAS_PARSER_API_KEY"), # This is the default and can be omitted
66-
# or 'production' | 'environment_2'; defaults to "production".
67-
environment="environment_1",
6864
)
6965

7066

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cas-parser-python"
3-
version = "1.5.0"
3+
version = "1.6.0"
44
description = "The official Python library for the cas-parser API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/cas_parser/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
77
from ._utils import file_from_path
88
from ._client import (
9-
ENVIRONMENTS,
109
Client,
1110
Stream,
1211
Timeout,
@@ -74,7 +73,6 @@
7473
"AsyncStream",
7574
"CasParser",
7675
"AsyncCasParser",
77-
"ENVIRONMENTS",
7876
"file_from_path",
7977
"BaseModel",
8078
"DEFAULT_TIMEOUT",

src/cas_parser/_client.py

Lines changed: 12 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from __future__ import annotations
44

55
import os
6-
from typing import TYPE_CHECKING, Any, Dict, Mapping, cast
7-
from typing_extensions import Self, Literal, override
6+
from typing import TYPE_CHECKING, Any, Mapping
7+
from typing_extensions import Self, override
88

99
import httpx
1010

@@ -59,7 +59,6 @@
5959
from .resources.inbound_email import InboundEmailResource, AsyncInboundEmailResource
6060

6161
__all__ = [
62-
"ENVIRONMENTS",
6362
"Timeout",
6463
"Transport",
6564
"ProxiesTypes",
@@ -70,25 +69,16 @@
7069
"AsyncClient",
7170
]
7271

73-
ENVIRONMENTS: Dict[str, str] = {
74-
"production": "https://portfolio-parser.api.casparser.in",
75-
"environment_1": "https://client-apis.casparser.in",
76-
"environment_2": "http://localhost:5000",
77-
}
78-
7972

8073
class CasParser(SyncAPIClient):
8174
# client options
8275
api_key: str
8376

84-
_environment: Literal["production", "environment_1", "environment_2"] | NotGiven
85-
8677
def __init__(
8778
self,
8879
*,
8980
api_key: str | None = None,
90-
environment: Literal["production", "environment_1", "environment_2"] | NotGiven = not_given,
91-
base_url: str | httpx.URL | None | NotGiven = not_given,
81+
base_url: str | httpx.URL | None = None,
9282
timeout: float | Timeout | None | NotGiven = not_given,
9383
max_retries: int = DEFAULT_MAX_RETRIES,
9484
default_headers: Mapping[str, str] | None = None,
@@ -119,31 +109,10 @@ def __init__(
119109
)
120110
self.api_key = api_key
121111

122-
self._environment = environment
123-
124-
base_url_env = os.environ.get("CAS_PARSER_BASE_URL")
125-
if is_given(base_url) and base_url is not None:
126-
# cast required because mypy doesn't understand the type narrowing
127-
base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast]
128-
elif is_given(environment):
129-
if base_url_env and base_url is not None:
130-
raise ValueError(
131-
"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",
132-
)
133-
134-
try:
135-
base_url = ENVIRONMENTS[environment]
136-
except KeyError as exc:
137-
raise ValueError(f"Unknown environment: {environment}") from exc
138-
elif base_url_env is not None:
139-
base_url = base_url_env
140-
else:
141-
self._environment = environment = "production"
142-
143-
try:
144-
base_url = ENVIRONMENTS[environment]
145-
except KeyError as exc:
146-
raise ValueError(f"Unknown environment: {environment}") from exc
112+
if base_url is None:
113+
base_url = os.environ.get("CAS_PARSER_BASE_URL")
114+
if base_url is None:
115+
base_url = f"https://api.casparser.in"
147116

148117
super().__init__(
149118
version=__version__,
@@ -260,7 +229,6 @@ def copy(
260229
self,
261230
*,
262231
api_key: str | None = None,
263-
environment: Literal["production", "environment_1", "environment_2"] | None = None,
264232
base_url: str | httpx.URL | None = None,
265233
timeout: float | Timeout | None | NotGiven = not_given,
266234
http_client: httpx.Client | None = None,
@@ -296,7 +264,6 @@ def copy(
296264
return self.__class__(
297265
api_key=api_key or self.api_key,
298266
base_url=base_url or self.base_url,
299-
environment=environment or self._environment,
300267
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
301268
http_client=http_client,
302269
max_retries=max_retries if is_given(max_retries) else self.max_retries,
@@ -347,14 +314,11 @@ class AsyncCasParser(AsyncAPIClient):
347314
# client options
348315
api_key: str
349316

350-
_environment: Literal["production", "environment_1", "environment_2"] | NotGiven
351-
352317
def __init__(
353318
self,
354319
*,
355320
api_key: str | None = None,
356-
environment: Literal["production", "environment_1", "environment_2"] | NotGiven = not_given,
357-
base_url: str | httpx.URL | None | NotGiven = not_given,
321+
base_url: str | httpx.URL | None = None,
358322
timeout: float | Timeout | None | NotGiven = not_given,
359323
max_retries: int = DEFAULT_MAX_RETRIES,
360324
default_headers: Mapping[str, str] | None = None,
@@ -385,31 +349,10 @@ def __init__(
385349
)
386350
self.api_key = api_key
387351

388-
self._environment = environment
389-
390-
base_url_env = os.environ.get("CAS_PARSER_BASE_URL")
391-
if is_given(base_url) and base_url is not None:
392-
# cast required because mypy doesn't understand the type narrowing
393-
base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast]
394-
elif is_given(environment):
395-
if base_url_env and base_url is not None:
396-
raise ValueError(
397-
"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",
398-
)
399-
400-
try:
401-
base_url = ENVIRONMENTS[environment]
402-
except KeyError as exc:
403-
raise ValueError(f"Unknown environment: {environment}") from exc
404-
elif base_url_env is not None:
405-
base_url = base_url_env
406-
else:
407-
self._environment = environment = "production"
408-
409-
try:
410-
base_url = ENVIRONMENTS[environment]
411-
except KeyError as exc:
412-
raise ValueError(f"Unknown environment: {environment}") from exc
352+
if base_url is None:
353+
base_url = os.environ.get("CAS_PARSER_BASE_URL")
354+
if base_url is None:
355+
base_url = f"https://api.casparser.in"
413356

414357
super().__init__(
415358
version=__version__,
@@ -526,7 +469,6 @@ def copy(
526469
self,
527470
*,
528471
api_key: str | None = None,
529-
environment: Literal["production", "environment_1", "environment_2"] | None = None,
530472
base_url: str | httpx.URL | None = None,
531473
timeout: float | Timeout | None | NotGiven = not_given,
532474
http_client: httpx.AsyncClient | None = None,
@@ -562,7 +504,6 @@ def copy(
562504
return self.__class__(
563505
api_key=api_key or self.api_key,
564506
base_url=base_url or self.base_url,
565-
environment=environment or self._environment,
566507
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
567508
http_client=http_client,
568509
max_retries=max_retries if is_given(max_retries) else self.max_retries,

src/cas_parser/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "cas_parser"
4-
__version__ = "1.5.0" # x-release-please-version
4+
__version__ = "1.6.0" # x-release-please-version

tests/test_client.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -691,18 +691,6 @@ def test_base_url_env(self) -> None:
691691
client = CasParser(api_key=api_key, _strict_response_validation=True)
692692
assert client.base_url == "http://localhost:5000/from/env/"
693693

694-
# explicit environment arg requires explicitness
695-
with update_env(CAS_PARSER_BASE_URL="http://localhost:5000/from/env"):
696-
with pytest.raises(ValueError, match=r"you must pass base_url=None"):
697-
CasParser(api_key=api_key, _strict_response_validation=True, environment="production")
698-
699-
client = CasParser(
700-
base_url=None, api_key=api_key, _strict_response_validation=True, environment="production"
701-
)
702-
assert str(client.base_url).startswith("https://portfolio-parser.api.casparser.in")
703-
704-
client.close()
705-
706694
@pytest.mark.parametrize(
707695
"client",
708696
[
@@ -1592,18 +1580,6 @@ async def test_base_url_env(self) -> None:
15921580
client = AsyncCasParser(api_key=api_key, _strict_response_validation=True)
15931581
assert client.base_url == "http://localhost:5000/from/env/"
15941582

1595-
# explicit environment arg requires explicitness
1596-
with update_env(CAS_PARSER_BASE_URL="http://localhost:5000/from/env"):
1597-
with pytest.raises(ValueError, match=r"you must pass base_url=None"):
1598-
AsyncCasParser(api_key=api_key, _strict_response_validation=True, environment="production")
1599-
1600-
client = AsyncCasParser(
1601-
base_url=None, api_key=api_key, _strict_response_validation=True, environment="production"
1602-
)
1603-
assert str(client.base_url).startswith("https://portfolio-parser.api.casparser.in")
1604-
1605-
await client.close()
1606-
16071583
@pytest.mark.parametrize(
16081584
"client",
16091585
[

0 commit comments

Comments
 (0)