cc-platform-sdk 2.0.0__tar.gz → 2.1.0__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.
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/CHANGELOG.md +11 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/PKG-INFO +1 -1
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/pyproject.toml +1 -1
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/__init__.py +1 -1
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/http/__init__.py +4 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/http/client.py +25 -2
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_all_specs.py +4 -1
- cc_platform_sdk-2.1.0/tests/conformance/test_transport.py +92 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/PROVENANCE +3 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/auth/test_service_principal.py +3 -2
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/test_distribution.py +1 -1
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/.gitignore +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/LICENSE +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/README.md +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/_resource_json.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/acting_user.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/config.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/credential_provider.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/exceptions.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/jwks_client.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/legacy_claims.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/middleware.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/models.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/resource_v2.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/security_identity.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/service_principal.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/config/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/config/settings.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/config/standard_config.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/context/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/context/context.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/context/middleware.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/errors/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/errors/catalog.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/errors/codes.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/errors/exceptions.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/errors/protocol_mappings.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/feature_flags/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/feature_flags/provider.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/feature_flags/types.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/protocol/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/protocol/envelope.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/protocol/headers.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/protocol/service_tier.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/events/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/events/envelope.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/events/payloads.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/events/validation.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/infra/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/infra/cache/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/infra/cache/client.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/infra/ratelimit/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/infra/ratelimit/config.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/infra/ratelimit/limiter.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/knowledge/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/knowledge/reference.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/lifecycle/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/lifecycle/health.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/lifecycle/lifecycle.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/lifecycle/types.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/correlation.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/diagnostics.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/envelope.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/instrumentation.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/interfaces.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/logging/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/logging/logger.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/metrics/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/metrics/helpers.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/metrics/registry.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/noop.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/tracing/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/tracing/config.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/tracing/tracer.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/grpc/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/grpc/interceptors.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/http/retry.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/kafka/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/kafka/consumer.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/kafka/errors.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/kafka/producer.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/serviceclient/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/serviceclient/client.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/serviceclient/discovery.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/serviceclient/grpc_adapter.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/serviceclient/http_adapter.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/serviceclient/kafka_adapter.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/serviceclient/types.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/utils/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/utils/ids.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/utils/serialization.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/utils/time.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/legacy_auth_corpus.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/loader.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_auth.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_contract_validation.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_errors.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_events.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_legacy_auth_cache.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_legacy_auth_context.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_legacy_auth_fresh.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_legacy_auth_v2.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_observability.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_protocol.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_resource_v2.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/401-invalid-credential.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/401-write-credential-on-read.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/get-400-id.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/get-404.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/get.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-400-limit.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-403-namespace.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-503.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-empty.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-limit-last.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-limit-more.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/responses.json +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/auth/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/auth/test_credential_provider.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/auth/test_middleware.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/auth/test_resource_v2.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/auth/test_security_identity.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/config/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/config/test_standard_config.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/context/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/context/test_propagation.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/context/test_security_identity_context.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/feature_flags/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/feature_flags/test_provider.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/knowledge/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/knowledge/test_reference.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/lifecycle/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/lifecycle/test_lifecycle.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/observability/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/observability/test_correlation.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/observability/test_hooks.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/observability/test_instrumentation.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/observability/test_interfaces.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/observability/test_parity.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/transport/__init__.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/transport/test_abstraction.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/transport/test_retry_integration.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/transport/test_service_client.py +0 -0
- {cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/uv.lock +0 -0
|
@@ -5,6 +5,17 @@ All notable changes to `cc-platform-sdk` will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.1.0]
|
|
9
|
+
|
|
10
|
+
### Security
|
|
11
|
+
|
|
12
|
+
- `HttpClient` no longer follows redirects by default: `HttpClientConfig.follow_redirects` defaults to `False`, and a
|
|
13
|
+
301, 302, 303, 307 or 308 raises the new `RedirectRefusedError` in one attempt, never retried, without a request to
|
|
14
|
+
the Location. Its message names no URL. Following one replayed `X-API-Key`, custom and identity headers to the
|
|
15
|
+
target (httpx strips only `Authorization` on a cross-origin hop). `follow_redirects=True` stays an explicit opt-in.
|
|
16
|
+
- Conformance: the shared `protocol/http-transport.spec.json` (redirect refusal, byte and range preservation, 416 not
|
|
17
|
+
retried), which the Go, Node and Rust SDKs pass too.
|
|
18
|
+
|
|
8
19
|
## [2.0.0]
|
|
9
20
|
|
|
10
21
|
### Added
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/http/__init__.py
RENAMED
|
@@ -8,6 +8,8 @@ from .client import (
|
|
|
8
8
|
HttpClient,
|
|
9
9
|
HttpClientConfig,
|
|
10
10
|
HttpResponse,
|
|
11
|
+
REDIRECT_STATUSES,
|
|
12
|
+
RedirectRefusedError,
|
|
11
13
|
RetryConfig,
|
|
12
14
|
)
|
|
13
15
|
from .retry import (
|
|
@@ -27,6 +29,8 @@ __all__ = [
|
|
|
27
29
|
"HttpClient",
|
|
28
30
|
"HttpClientConfig",
|
|
29
31
|
"HttpResponse",
|
|
32
|
+
"REDIRECT_STATUSES",
|
|
33
|
+
"RedirectRefusedError",
|
|
30
34
|
"RetryConfig",
|
|
31
35
|
# Retry Classification (Layer 6)
|
|
32
36
|
"RetryClassification",
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/http/client.py
RENAMED
|
@@ -26,6 +26,20 @@ import httpx
|
|
|
26
26
|
|
|
27
27
|
logger = logging.getLogger(__name__)
|
|
28
28
|
|
|
29
|
+
REDIRECT_STATUSES = frozenset({301, 302, 303, 307, 308})
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class RedirectRefusedError(RuntimeError):
|
|
33
|
+
"""A response redirected the request, and the client does not follow redirects.
|
|
34
|
+
|
|
35
|
+
Following one would replay the caller's custom headers, ``X-API-Key`` and the context's identity headers to the
|
|
36
|
+
target: httpx strips only ``Authorization`` on a cross-origin hop. A redirect is a failed call, never retried, and
|
|
37
|
+
the message names no URL (as go-sdk's errRedirect and the shared protocol/http-transport spec).
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __init__(self) -> None:
|
|
41
|
+
super().__init__("transport/http: a request never follows a redirect")
|
|
42
|
+
|
|
29
43
|
|
|
30
44
|
# ---------------------------------------------------------------------------
|
|
31
45
|
# Configuration
|
|
@@ -69,7 +83,9 @@ class HttpClientConfig:
|
|
|
69
83
|
circuit_breaker_timeout: Seconds to wait before half-open probe.
|
|
70
84
|
retry_config: Full retry configuration (takes precedence over shorthand fields).
|
|
71
85
|
service_name: Calling service name for User-Agent and headers.
|
|
72
|
-
follow_redirects: Whether to follow HTTP redirects.
|
|
86
|
+
follow_redirects: Whether to follow HTTP redirects. Default False: a redirect raises
|
|
87
|
+
``RedirectRefusedError`` without a request to its Location. True is an explicit opt-in that replays
|
|
88
|
+
``X-API-Key``, custom and identity headers to the target.
|
|
73
89
|
verify_ssl: Whether to verify TLS certificates.
|
|
74
90
|
http2: Whether to enable HTTP/2.
|
|
75
91
|
auth_token: Optional Bearer token for Authorization header.
|
|
@@ -86,7 +102,7 @@ class HttpClientConfig:
|
|
|
86
102
|
circuit_breaker_timeout: float = 60.0
|
|
87
103
|
retry_config: RetryConfig | None = None
|
|
88
104
|
service_name: str = ""
|
|
89
|
-
follow_redirects: bool =
|
|
105
|
+
follow_redirects: bool = False
|
|
90
106
|
verify_ssl: bool = True
|
|
91
107
|
http2: bool = False
|
|
92
108
|
auth_token: str | None = None
|
|
@@ -390,6 +406,8 @@ class HttpClient:
|
|
|
390
406
|
kwargs["params"] = params
|
|
391
407
|
|
|
392
408
|
response = await self._client.request(**kwargs)
|
|
409
|
+
if not self._config.follow_redirects and response.status_code in REDIRECT_STATUSES:
|
|
410
|
+
raise RedirectRefusedError()
|
|
393
411
|
|
|
394
412
|
# Check for retryable status
|
|
395
413
|
if (
|
|
@@ -411,6 +429,9 @@ class HttpClient:
|
|
|
411
429
|
headers=dict(response.headers),
|
|
412
430
|
)
|
|
413
431
|
|
|
432
|
+
except RedirectRefusedError:
|
|
433
|
+
raise
|
|
434
|
+
|
|
414
435
|
except httpx.TimeoutException as exc:
|
|
415
436
|
last_error = exc
|
|
416
437
|
if self._circuit_breaker:
|
|
@@ -511,5 +532,7 @@ __all__ = [
|
|
|
511
532
|
"HttpClient",
|
|
512
533
|
"HttpClientConfig",
|
|
513
534
|
"HttpResponse",
|
|
535
|
+
"REDIRECT_STATUSES",
|
|
536
|
+
"RedirectRefusedError",
|
|
514
537
|
"RetryConfig",
|
|
515
538
|
]
|
|
@@ -24,6 +24,7 @@ SPEC_HANDLERS: dict[str, bool] = {
|
|
|
24
24
|
"protocol/request-envelope.spec.json": True,
|
|
25
25
|
"protocol/response-envelope.spec.json": True,
|
|
26
26
|
"protocol/service-tier-retry.spec.json": True,
|
|
27
|
+
"protocol/http-transport.spec.json": True,
|
|
27
28
|
"observability/logger-interface.spec.json": True,
|
|
28
29
|
"observability/metrics-interface.spec.json": True,
|
|
29
30
|
"observability/tracer-interface.spec.json": True,
|
|
@@ -33,7 +34,9 @@ SPEC_HANDLERS: dict[str, bool] = {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
# Map of spec file relative paths that are intentionally skipped.
|
|
36
|
-
SKIPPED_SPECS: dict[str, str] = {
|
|
37
|
+
SKIPPED_SPECS: dict[str, str] = {
|
|
38
|
+
"technology-management/installation-lifecycle.spec.json": "proposed contract (#297); no SDK binding until owner approval; the Universal Runtime contract conformance test checks it",
|
|
39
|
+
}
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
def test_all_spec_files_have_handlers() -> None:
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""protocol/http-transport.spec.json: redirect refusal, byte and range preservation.
|
|
2
|
+
|
|
3
|
+
Each case is served by a local origin server, with a second local server as {other_origin}, through the platform
|
|
4
|
+
HttpClient with its default configuration.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import base64
|
|
10
|
+
import threading
|
|
11
|
+
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
import pytest
|
|
15
|
+
|
|
16
|
+
from cc_platform_sdk.transport.http import HttpClient, HttpClientConfig, RedirectRefusedError
|
|
17
|
+
|
|
18
|
+
from .loader import load_spec
|
|
19
|
+
|
|
20
|
+
SPEC = load_spec("protocol/http-transport.spec.json")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class _Server:
|
|
24
|
+
def __init__(self, respond: Any) -> None:
|
|
25
|
+
self.requests: list[tuple[str, dict[str, str]]] = []
|
|
26
|
+
outer = self
|
|
27
|
+
|
|
28
|
+
class Handler(BaseHTTPRequestHandler):
|
|
29
|
+
def do_GET(self) -> None: # noqa: N802
|
|
30
|
+
outer.requests.append((self.path.split("?")[0], dict(self.headers)))
|
|
31
|
+
respond(self)
|
|
32
|
+
|
|
33
|
+
def log_message(self, *args: Any) -> None:
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
self.httpd = ThreadingHTTPServer(("127.0.0.1", 0), Handler)
|
|
37
|
+
self.url = f"http://127.0.0.1:{self.httpd.server_address[1]}"
|
|
38
|
+
threading.Thread(target=self.httpd.serve_forever, daemon=True).start()
|
|
39
|
+
|
|
40
|
+
def close(self) -> None:
|
|
41
|
+
self.httpd.shutdown()
|
|
42
|
+
self.httpd.server_close()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _empty(handler: BaseHTTPRequestHandler) -> None:
|
|
46
|
+
handler.send_response(200)
|
|
47
|
+
handler.send_header("Content-Length", "0")
|
|
48
|
+
handler.end_headers()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@pytest.mark.parametrize("case", SPEC.cases, ids=[c.id for c in SPEC.cases])
|
|
52
|
+
async def test_http_transport(case: Any) -> None:
|
|
53
|
+
inp, want = case.input, case.expected
|
|
54
|
+
path = inp["request"]["path"]
|
|
55
|
+
other = _Server(_empty)
|
|
56
|
+
location = inp["response"]["headers"].get("Location", "").replace("{other_origin}", other.url)
|
|
57
|
+
body = base64.b64decode(inp["response"].get("body_base64", ""))
|
|
58
|
+
|
|
59
|
+
def respond(handler: BaseHTTPRequestHandler) -> None:
|
|
60
|
+
if handler.path.split("?")[0] != path:
|
|
61
|
+
_empty(handler)
|
|
62
|
+
return
|
|
63
|
+
handler.send_response(inp["response"]["status"])
|
|
64
|
+
for k, v in inp["response"]["headers"].items():
|
|
65
|
+
handler.send_header(k, location if k == "Location" else v)
|
|
66
|
+
handler.send_header("Content-Length", str(len(body)))
|
|
67
|
+
handler.end_headers()
|
|
68
|
+
handler.wfile.write(body)
|
|
69
|
+
|
|
70
|
+
origin = _Server(respond)
|
|
71
|
+
try:
|
|
72
|
+
async with HttpClient(HttpClientConfig(base_url=origin.url, timeout=5.0)) as client:
|
|
73
|
+
if want["outcome"] == "refused":
|
|
74
|
+
with pytest.raises(RedirectRefusedError) as raised:
|
|
75
|
+
await client.get(path, headers=dict(inp["request"]["headers"]))
|
|
76
|
+
mentions = bool(location) and location in str(raised.value)
|
|
77
|
+
assert mentions == want["error_mentions_location"]
|
|
78
|
+
else:
|
|
79
|
+
resp = await client.get(path, headers=dict(inp["request"]["headers"]))
|
|
80
|
+
assert resp.status_code == want["status"]
|
|
81
|
+
if want["outcome"] == "response":
|
|
82
|
+
assert base64.b64encode(resp.body).decode() == want["body_base64"]
|
|
83
|
+
headers = {k.lower(): v for k, v in resp.headers.items()}
|
|
84
|
+
assert headers.get("content-range") == want["content_range"]
|
|
85
|
+
attempts = [r for r in origin.requests if r[0] == path]
|
|
86
|
+
assert len(attempts) == want["attempts"]
|
|
87
|
+
assert len(origin.requests) - len(attempts) + len(other.requests) == want.get("location_requests", 0)
|
|
88
|
+
if "range_sent" in want:
|
|
89
|
+
assert {k.lower(): v for k, v in attempts[0][1].items()}.get("range") == want["range_sent"]
|
|
90
|
+
finally:
|
|
91
|
+
origin.close()
|
|
92
|
+
other.close()
|
|
@@ -30,3 +30,6 @@ Values that are NOT stable across recordings (never assert them literally): node
|
|
|
30
30
|
created_at/updated_at (Go time from the store, here in the recording host's zone -07:00; a UTC host emits "Z"), and
|
|
31
31
|
the middleware timestamp. responses.json maps each file to its method, path, credential label, status, content type
|
|
32
32
|
and body sha256.
|
|
33
|
+
|
|
34
|
+
Note (WP-SEC-7b follow-up): `spcontract.Audience` above was then an alias of `spcontract.AudienceGraphReference`
|
|
35
|
+
("ccu-graph.reference"); the alias has since been removed and callers name the resource. The recording is unchanged.
|
|
@@ -312,8 +312,9 @@ def test_the_restated_contract_matches_go_and_ts() -> None:
|
|
|
312
312
|
assert ours == ts[ts_name], name
|
|
313
313
|
if go_name:
|
|
314
314
|
assert ours == go[go_name], name
|
|
315
|
-
# K1-5b: the default audience IS the contract's constant
|
|
316
|
-
|
|
315
|
+
# K1-5b: the default audience IS the contract's graph resource constant. The Go `Audience` alias that once spelled
|
|
316
|
+
# this (`const Audience = AudienceGraphReference`) was removed by the WP-SEC-7b follow-up: callers name the resource.
|
|
317
|
+
assert 'const AudienceGraphReference = "ccu-graph.reference"' in GO_CONTRACT.read_text()
|
|
317
318
|
assert sp.AUDIENCE == sp.AUDIENCE_GRAPH_REFERENCE
|
|
318
319
|
assert sp.obtain_credential.__defaults__ == (sp.AUDIENCE,)
|
|
319
320
|
|
|
@@ -22,7 +22,7 @@ def test_public_auth_exports_are_available():
|
|
|
22
22
|
|
|
23
23
|
def test_installed_release_metadata_and_dependencies():
|
|
24
24
|
distribution = importlib.metadata.distribution('cc-platform-sdk')
|
|
25
|
-
assert distribution.version == cc_platform_sdk.__version__ == '2.
|
|
25
|
+
assert distribution.version == cc_platform_sdk.__version__ == '2.1.0'
|
|
26
26
|
requirements = [Requirement(r) for r in distribution.requires]
|
|
27
27
|
required = {'pydantic', 'pydantic-settings', 'email-validator', 'httpx', 'redis', 'pyjwt'}
|
|
28
28
|
assert required <= {r.name.lower() for r in requirements if r.marker is None}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/credential_provider.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/security_identity.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/auth/service_principal.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/config/standard_config.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/context/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/context/middleware.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/errors/exceptions.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/errors/protocol_mappings.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/feature_flags/__init__.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/feature_flags/provider.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/feature_flags/types.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/protocol/__init__.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/protocol/envelope.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/protocol/headers.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/core/protocol/service_tier.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/infra/ratelimit/__init__.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/infra/ratelimit/config.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/infra/ratelimit/limiter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/__init__.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/correlation.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/diagnostics.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/envelope.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/instrumentation.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/interfaces.py
RENAMED
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/logging/logger.py
RENAMED
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/metrics/helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/tracing/config.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/observability/tracing/tracer.py
RENAMED
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/grpc/__init__.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/grpc/interceptors.py
RENAMED
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/kafka/__init__.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/kafka/consumer.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/kafka/errors.py
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/kafka/producer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/src/cc_platform_sdk/transport/serviceclient/types.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_contract_validation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/conformance/test_legacy_auth_context.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/get-400-id.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-400-limit.json
RENAMED
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-503.json
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-empty.json
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-limit-last.json
RENAMED
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/list-limit-more.json
RENAMED
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/fixtures/graph_reference/responses.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/context/test_security_identity_context.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/observability/test_correlation.py
RENAMED
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/observability/test_instrumentation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cc_platform_sdk-2.0.0 → cc_platform_sdk-2.1.0}/tests/unit/transport/test_retry_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|