ccflow-http 0.4.0__tar.gz → 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/PKG-INFO +3 -3
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/README.md +1 -1
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/ccflow_http/__init__.py +1 -1
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/ccflow_http/base.py +4 -4
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/ccflow_http/tests/test_model.py +35 -0
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/pyproject.toml +3 -3
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/.gitignore +0 -0
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/LICENSE +0 -0
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/ccflow_http/download.py +0 -0
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/ccflow_http/tests/test_all.py +0 -0
- {ccflow_http-0.4.0 → ccflow_http-0.4.1}/ccflow_http/tests/test_download.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: ccflow-http
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: ccflow models for HTTP
|
|
5
5
|
Project-URL: Repository, https://github.com/1kbgz/ccflow-http
|
|
6
6
|
Project-URL: Homepage, https://github.com/1kbgz/ccflow-http
|
|
@@ -28,7 +28,7 @@ Requires-Dist: check-dist; extra == 'develop'
|
|
|
28
28
|
Requires-Dist: codespell; extra == 'develop'
|
|
29
29
|
Requires-Dist: hatchling; extra == 'develop'
|
|
30
30
|
Requires-Dist: mdformat; extra == 'develop'
|
|
31
|
-
Requires-Dist: mdformat-
|
|
31
|
+
Requires-Dist: mdformat-myst; extra == 'develop'
|
|
32
32
|
Requires-Dist: mdformat-tables>=1; extra == 'develop'
|
|
33
33
|
Requires-Dist: pytest; extra == 'develop'
|
|
34
34
|
Requires-Dist: pytest-cov; extra == 'develop'
|
|
@@ -56,7 +56,7 @@ It should not contain provider-specific endpoint catalogs. Domain packages can c
|
|
|
56
56
|
|
|
57
57
|
## Current Status
|
|
58
58
|
|
|
59
|
-
- Implemented: `HTTPConfig`, `HTTPAuth`, `HTTPContext`, `HTTPRequestContext`, `HTTPRequest`, `HTTPRetryPolicy`, `HTTPResponseResult`, compatibility `HTTPResult`, `HTTPModel`, templated path/query/header rendering, request explanation through `build_request`, no-auth/bearer/API-key/basic auth helpers, JSON/text/bytes/CSV/gzip response parsing, HTTP status retry classification over `ccflow` retry semantics, accepted error statuses returned as results instead of exceptions, retry event summaries on HTTP results, `ccflow-etl` `ExecutionPolicy` request spacing, `next_url`/cursor/page/offset pagination, rate-limit header capture, a configurable `RedactionPolicy` (`HTTPModel.redaction`: exact names, substrings, and patterns, with `auth` header and query names added automatically) that masks secret header and query values in `httpx2` request logs, request dumps, result URLs, retry events, and errors, `HTTPDownloadModel` for streaming a response to a local file with size and SHA-256, `HTTPArtifactCaptureModel` for storing a dated download plus a manifest through a `ccflow-etl` file writer, and mocked `httpx2` transport tests.
|
|
59
|
+
- Implemented: `HTTPConfig`, `HTTPAuth`, `HTTPContext`, `HTTPRequestContext`, `HTTPRequest`, `HTTPRetryPolicy`, `HTTPResponseResult`, compatibility `HTTPResult`, `HTTPModel`, templated path/query/header rendering, request explanation through `build_request`, no-auth/bearer/API-key/basic auth helpers, JSON/text/bytes/CSV/gzip response parsing, HTTP status retry classification over `ccflow` retry semantics, accepted error statuses returned as results instead of exceptions, retry event summaries on HTTP results, `ccflow-etl` `ExecutionPolicy` request spacing, `next_url`/cursor/page/offset pagination, rate-limit header capture, a configurable `RedactionPolicy` (`HTTPModel.redaction`: exact names, substrings, and patterns, with `auth` header and query names added automatically) that masks secret header and query values in `httpx2` request logs, request dumps, result URLs and headers, retry events, and errors, `HTTPDownloadModel` for streaming a response to a local file with size and SHA-256, `HTTPArtifactCaptureModel` for storing a dated download plus a manifest through a `ccflow-etl` file writer, and mocked `httpx2` transport tests.
|
|
60
60
|
- Partial: the shared execution policy is currently consumed inside `HTTPModel` for sequential request spacing; broader evaluator-level concurrency coordination still belongs in evaluator integrations.
|
|
61
61
|
- Missing: broader integration examples and provider-specific subclasses/configs in downstream packages.
|
|
62
62
|
|
|
@@ -15,7 +15,7 @@ It should not contain provider-specific endpoint catalogs. Domain packages can c
|
|
|
15
15
|
|
|
16
16
|
## Current Status
|
|
17
17
|
|
|
18
|
-
- Implemented: `HTTPConfig`, `HTTPAuth`, `HTTPContext`, `HTTPRequestContext`, `HTTPRequest`, `HTTPRetryPolicy`, `HTTPResponseResult`, compatibility `HTTPResult`, `HTTPModel`, templated path/query/header rendering, request explanation through `build_request`, no-auth/bearer/API-key/basic auth helpers, JSON/text/bytes/CSV/gzip response parsing, HTTP status retry classification over `ccflow` retry semantics, accepted error statuses returned as results instead of exceptions, retry event summaries on HTTP results, `ccflow-etl` `ExecutionPolicy` request spacing, `next_url`/cursor/page/offset pagination, rate-limit header capture, a configurable `RedactionPolicy` (`HTTPModel.redaction`: exact names, substrings, and patterns, with `auth` header and query names added automatically) that masks secret header and query values in `httpx2` request logs, request dumps, result URLs, retry events, and errors, `HTTPDownloadModel` for streaming a response to a local file with size and SHA-256, `HTTPArtifactCaptureModel` for storing a dated download plus a manifest through a `ccflow-etl` file writer, and mocked `httpx2` transport tests.
|
|
18
|
+
- Implemented: `HTTPConfig`, `HTTPAuth`, `HTTPContext`, `HTTPRequestContext`, `HTTPRequest`, `HTTPRetryPolicy`, `HTTPResponseResult`, compatibility `HTTPResult`, `HTTPModel`, templated path/query/header rendering, request explanation through `build_request`, no-auth/bearer/API-key/basic auth helpers, JSON/text/bytes/CSV/gzip response parsing, HTTP status retry classification over `ccflow` retry semantics, accepted error statuses returned as results instead of exceptions, retry event summaries on HTTP results, `ccflow-etl` `ExecutionPolicy` request spacing, `next_url`/cursor/page/offset pagination, rate-limit header capture, a configurable `RedactionPolicy` (`HTTPModel.redaction`: exact names, substrings, and patterns, with `auth` header and query names added automatically) that masks secret header and query values in `httpx2` request logs, request dumps, result URLs and headers, retry events, and errors, `HTTPDownloadModel` for streaming a response to a local file with size and SHA-256, `HTTPArtifactCaptureModel` for storing a dated download plus a manifest through a `ccflow-etl` file writer, and mocked `httpx2` transport tests.
|
|
19
19
|
- Partial: the shared execution policy is currently consumed inside `HTTPModel` for sequential request spacing; broader evaluator-level concurrency coordination still belongs in evaluator integrations.
|
|
20
20
|
- Missing: broader integration examples and provider-specific subclasses/configs in downstream packages.
|
|
21
21
|
|
|
@@ -52,11 +52,11 @@ class HTTPConfig(BaseModel):
|
|
|
52
52
|
|
|
53
53
|
class HTTPAuth(BaseModel):
|
|
54
54
|
strategy: HTTPAuthStrategy = "none"
|
|
55
|
-
token: str | None = None
|
|
55
|
+
token: str | None = Field(default=None, repr=False)
|
|
56
56
|
name: str | None = None
|
|
57
|
-
value: str | None = None
|
|
57
|
+
value: str | None = Field(default=None, repr=False)
|
|
58
58
|
username: str | None = None
|
|
59
|
-
password: str | None = None
|
|
59
|
+
password: str | None = Field(default=None, repr=False)
|
|
60
60
|
scheme: str = "Bearer"
|
|
61
61
|
|
|
62
62
|
|
|
@@ -667,7 +667,7 @@ class HTTPModel(CallableModel):
|
|
|
667
667
|
return HTTPResult(
|
|
668
668
|
value=None if accepted_error else (self._merge_page_values(values) if self.paginate else values[-1]),
|
|
669
669
|
status_code=response.status_code,
|
|
670
|
-
headers=dict(response.headers or {}),
|
|
670
|
+
headers=redaction.redact_mapping(dict(response.headers or {})),
|
|
671
671
|
url=redaction.redact_url(str(response.url)),
|
|
672
672
|
attempts=total_attempts,
|
|
673
673
|
pages=pages,
|
|
@@ -862,3 +862,38 @@ def test_http_model_applies_configured_and_auth_redaction_names_everywhere(caplo
|
|
|
862
862
|
assert result.url == "https://api.example.test/v1/items?sig=***&date=2025-01-02"
|
|
863
863
|
assert "query-secret" not in caplog.text
|
|
864
864
|
assert "query-secret" not in result.retry_events[0]["message"]
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
def test_http_model_redacts_sensitive_response_headers():
|
|
868
|
+
def handler(request: httpx2.Request) -> httpx2.Response:
|
|
869
|
+
return httpx2.Response(
|
|
870
|
+
200,
|
|
871
|
+
json={"ok": True},
|
|
872
|
+
headers={"Set-Cookie": "session=cookie-secret", "X-Auth-Token": "token-secret", "X-Request-ID": "req-1"},
|
|
873
|
+
)
|
|
874
|
+
|
|
875
|
+
model = HTTPModel(
|
|
876
|
+
config=HTTPConfig(base_url="https://api.example.test", transport=httpx2.MockTransport(handler)),
|
|
877
|
+
path="/v1/items",
|
|
878
|
+
)
|
|
879
|
+
|
|
880
|
+
result = model(HTTPRequestContext())
|
|
881
|
+
|
|
882
|
+
assert result.headers["set-cookie"] == "***"
|
|
883
|
+
assert result.headers["x-auth-token"] == "***"
|
|
884
|
+
assert result.headers["x-request-id"] == "req-1"
|
|
885
|
+
assert "secret" not in repr(result)
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
def test_http_auth_repr_omits_secrets():
|
|
889
|
+
auths = [
|
|
890
|
+
HTTPAuth(strategy="bearer", token="bearer-secret"),
|
|
891
|
+
HTTPAuth(strategy="api_key_header", name="X-Api-Key", value="key-secret"),
|
|
892
|
+
HTTPAuth(strategy="basic", username="svc", password="basic-secret"),
|
|
893
|
+
]
|
|
894
|
+
|
|
895
|
+
for auth in auths:
|
|
896
|
+
assert "secret" not in repr(auth)
|
|
897
|
+
assert "secret" not in str(auth)
|
|
898
|
+
assert "X-Api-Key" in repr(auths[1])
|
|
899
|
+
assert "svc" in repr(auths[2])
|
|
@@ -12,7 +12,7 @@ authors = [
|
|
|
12
12
|
description = "ccflow models for HTTP"
|
|
13
13
|
readme = "README.md"
|
|
14
14
|
license = { text = "Apache-2.0" }
|
|
15
|
-
version = "0.4.
|
|
15
|
+
version = "0.4.1"
|
|
16
16
|
requires-python = ">=3.11"
|
|
17
17
|
keywords = []
|
|
18
18
|
|
|
@@ -43,7 +43,7 @@ develop = [
|
|
|
43
43
|
"codespell",
|
|
44
44
|
"hatchling",
|
|
45
45
|
"mdformat",
|
|
46
|
-
"mdformat-
|
|
46
|
+
"mdformat-myst",
|
|
47
47
|
"mdformat-tables>=1",
|
|
48
48
|
"pytest",
|
|
49
49
|
"pytest-cov",
|
|
@@ -61,7 +61,7 @@ Repository = "https://github.com/1kbgz/ccflow-http"
|
|
|
61
61
|
Homepage = "https://github.com/1kbgz/ccflow-http"
|
|
62
62
|
|
|
63
63
|
[tool.bumpversion]
|
|
64
|
-
current_version = "0.4.
|
|
64
|
+
current_version = "0.4.1"
|
|
65
65
|
commit = true
|
|
66
66
|
tag = true
|
|
67
67
|
commit_args = "-s"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|