Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.9.13'
version: '0.10.2'

- name: Install dependencies
run: uv sync --all-extras
Expand All @@ -46,7 +46,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.9.13'
version: '0.10.2'

- name: Install dependencies
run: uv sync --all-extras
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.9.13'
version: '0.10.2'

- name: Bootstrap
run: ./scripts/bootstrap
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.6.0"
".": "1.6.1"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 1.6.1 (2026-03-03)

Full Changelog: [v1.6.0...v1.6.1](https://github.com/CASParser/cas-parser-python/compare/v1.6.0...v1.6.1)

### Chores

* **ci:** bump uv version ([8b38574](https://github.com/CASParser/cas-parser-python/commit/8b38574493387605ea62763e2dac86b90cb41697))
* **internal:** add request options to SSE classes ([7488011](https://github.com/CASParser/cas-parser-python/commit/74880111923232fba22d9870f00aabf17cd7ef2f))
* **internal:** codegen related update ([b9079a9](https://github.com/CASParser/cas-parser-python/commit/b9079a9473681d297cfdd4165e2aae413d784bfd))
* **internal:** make `test_proxy_environment_variables` more resilient ([3608c6e](https://github.com/CASParser/cas-parser-python/commit/3608c6eddf68e65c153c4e186346b79859aab866))
* **internal:** make `test_proxy_environment_variables` more resilient to env ([60ab278](https://github.com/CASParser/cas-parser-python/commit/60ab27826aeea8d2b9dc6ec19f8a94bc4108b180))
* **internal:** refactor authentication internals ([deb70b3](https://github.com/CASParser/cas-parser-python/commit/deb70b3a007f6596260f115d964f69cd55b456c3))

## 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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cas-parser-python"
version = "1.6.0"
version = "1.6.1"
description = "The official Python library for the cas-parser API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
34 changes: 28 additions & 6 deletions src/cas_parser/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
)
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
from ._compat import PYDANTIC_V1, model_copy, model_dump
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
from ._models import GenericModel, SecurityOptions, FinalRequestOptions, validate_type, construct_type
from ._response import (
APIResponse,
BaseAPIResponse,
Expand Down Expand Up @@ -432,9 +432,27 @@ def _make_status_error(
) -> _exceptions.APIStatusError:
raise NotImplementedError()

def _auth_headers(
self,
security: SecurityOptions, # noqa: ARG002
) -> dict[str, str]:
return {}

def _auth_query(
self,
security: SecurityOptions, # noqa: ARG002
) -> dict[str, str]:
return {}

def _custom_auth(
self,
security: SecurityOptions, # noqa: ARG002
) -> httpx.Auth | None:
return None

def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0) -> httpx.Headers:
custom_headers = options.headers or {}
headers_dict = _merge_mappings(self.default_headers, custom_headers)
headers_dict = _merge_mappings({**self._auth_headers(options.security), **self.default_headers}, custom_headers)
self._validate_headers(headers_dict, custom_headers)

# headers are case-insensitive while dictionaries are not.
Expand Down Expand Up @@ -506,7 +524,7 @@ def _build_request(
raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`")

headers = self._build_headers(options, retries_taken=retries_taken)
params = _merge_mappings(self.default_query, options.params)
params = _merge_mappings({**self._auth_query(options.security), **self.default_query}, options.params)
content_type = headers.get("Content-Type")
files = options.files

Expand Down Expand Up @@ -671,7 +689,6 @@ def default_headers(self) -> dict[str, str | Omit]:
"Content-Type": "application/json",
"User-Agent": self.user_agent,
**self.platform_headers(),
**self.auth_headers,
**self._custom_headers,
}

Expand Down Expand Up @@ -990,8 +1007,9 @@ def request(
self._prepare_request(request)

kwargs: HttpxSendArgs = {}
if self.custom_auth is not None:
kwargs["auth"] = self.custom_auth
custom_auth = self._custom_auth(options.security)
if custom_auth is not None:
kwargs["auth"] = custom_auth

if options.follow_redirects is not None:
kwargs["follow_redirects"] = options.follow_redirects
Expand Down Expand Up @@ -1952,6 +1970,7 @@ def make_request_options(
idempotency_key: str | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
post_parser: PostParser | NotGiven = not_given,
security: SecurityOptions | None = None,
) -> RequestOptions:
"""Create a dict of type RequestOptions without keys of NotGiven values."""
options: RequestOptions = {}
Expand All @@ -1977,6 +1996,9 @@ def make_request_options(
# internal
options["post_parser"] = post_parser # type: ignore

if security is not None:
options["security"] = security

return options


Expand Down
Loading