corehttp 1.0.0b5__tar.gz → 1.0.0b7__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.
- corehttp-1.0.0b7/CHANGELOG.md +93 -0
- corehttp-1.0.0b7/PKG-INFO +196 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/_version.py +1 -1
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/credentials.py +66 -25
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/exceptions.py +7 -6
- corehttp-1.0.0b7/corehttp/instrumentation/__init__.py +9 -0
- corehttp-1.0.0b7/corehttp/instrumentation/tracing/__init__.py +14 -0
- corehttp-1.0.0b7/corehttp/instrumentation/tracing/_decorator.py +189 -0
- corehttp-1.0.0b7/corehttp/instrumentation/tracing/_models.py +72 -0
- corehttp-1.0.0b7/corehttp/instrumentation/tracing/_tracer.py +69 -0
- corehttp-1.0.0b7/corehttp/instrumentation/tracing/opentelemetry.py +277 -0
- corehttp-1.0.0b7/corehttp/instrumentation/tracing/utils.py +31 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/paging.py +13 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/rest/_aiohttp.py +21 -9
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/rest/_http_response_impl.py +9 -15
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/rest/_http_response_impl_async.py +2 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/rest/_httpx.py +9 -9
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/rest/_requests_basic.py +17 -10
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/rest/_rest_py3.py +6 -10
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/pipeline/__init__.py +5 -9
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/pipeline/_base.py +3 -2
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/pipeline/_base_async.py +6 -8
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/pipeline/_tools.py +18 -2
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/pipeline/_tools_async.py +2 -4
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/policies/__init__.py +2 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/policies/_authentication.py +76 -24
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/policies/_authentication_async.py +66 -21
- corehttp-1.0.0b7/corehttp/runtime/policies/_distributed_tracing.py +169 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/policies/_retry.py +8 -12
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/policies/_retry_async.py +5 -9
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/policies/_universal.py +15 -11
- corehttp-1.0.0b7/corehttp/serialization.py +358 -0
- corehttp-1.0.0b7/corehttp/settings.py +59 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/_base.py +1 -3
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/_base_async.py +1 -3
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/aiohttp/_aiohttp.py +41 -16
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/requests/_bigger_block_size_http_adapters.py +1 -1
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/requests/_requests_basic.py +33 -18
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/utils/_enum_meta.py +1 -1
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/utils/_utils.py +2 -1
- corehttp-1.0.0b7/corehttp.egg-info/PKG-INFO +196 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp.egg-info/SOURCES.txt +26 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp.egg-info/requires.txt +3 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/pyproject.toml +1 -1
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/samples/sample_async_pipeline_client.py +0 -10
- corehttp-1.0.0b7/samples/sample_tracing.py +97 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/setup.py +6 -2
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_authentication_async.py +128 -25
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_rest_http_response_async.py +27 -27
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_rest_stream_responses_async.py +1 -34
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_streaming_async.py +34 -148
- corehttp-1.0.0b7/tests/async_tests/test_tracing_decorator_async.py +131 -0
- corehttp-1.0.0b7/tests/async_tests/test_tracing_policy_async.py +68 -0
- corehttp-1.0.0b7/tests/async_tests/test_transport_async.py +121 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/conftest.py +29 -0
- corehttp-1.0.0b7/tests/perf_tests/__init__.py +0 -0
- corehttp-1.0.0b7/tests/perf_tests/_test_base.py +258 -0
- corehttp-1.0.0b7/tests/perf_tests/custom_iterator.py +80 -0
- corehttp-1.0.0b7/tests/perf_tests/download_binary.py +94 -0
- corehttp-1.0.0b7/tests/perf_tests/list_entities_json.py +135 -0
- corehttp-1.0.0b7/tests/perf_tests/query_entities_json.py +85 -0
- corehttp-1.0.0b7/tests/perf_tests/update_entity_json.py +92 -0
- corehttp-1.0.0b7/tests/perf_tests/upload_binary.py +91 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_authentication.py +133 -32
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_exceptions.py +14 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_rest_stream_responses.py +0 -53
- corehttp-1.0.0b7/tests/test_settings.py +43 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_stream_generator.py +3 -2
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_streaming.py +32 -131
- corehttp-1.0.0b7/tests/test_tracer_otel.py +423 -0
- corehttp-1.0.0b7/tests/test_tracing_decorator.py +122 -0
- corehttp-1.0.0b7/tests/test_tracing_policy.py +270 -0
- corehttp-1.0.0b7/tests/test_transport.py +95 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/helpers.py +2 -2
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/multipart.py +1 -7
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/streams.py +14 -0
- corehttp-1.0.0b5/CHANGELOG.md +0 -45
- corehttp-1.0.0b5/PKG-INFO +0 -132
- corehttp-1.0.0b5/corehttp/serialization.py +0 -124
- corehttp-1.0.0b5/corehttp.egg-info/PKG-INFO +0 -132
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/LICENSE +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/MANIFEST.in +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/README.md +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/_match_conditions.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/py.typed +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/rest/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/rest/_helpers.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/_base.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/_pipeline_client.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/_pipeline_client_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/policies/_base.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/policies/_base_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/runtime/policies/_utils.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/aiohttp/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/httpx/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/httpx/_httpx.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/transport/requests/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp/utils/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp.egg-info/dependency_links.txt +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp.egg-info/not-zip-safe +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/corehttp.egg-info/top_level.txt +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/samples/sample_pipeline_client.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/setup.cfg +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/conftest.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/rest_client_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_content_length_checking_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_paging_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_pipeline_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_rest_context_manager_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_rest_headers_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_rest_http_request_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_retry_policy_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_testserver_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/async_tests/test_universal_http_async.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/rest_client.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_content_length_checking.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_enums.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_error_map.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_paging.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_pipeline.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_requests_universal.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_rest_context_manager.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_rest_headers.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_rest_http_request.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_rest_http_response.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_rest_query.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_retry_policy.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_serialization.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_testserver.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_universal_pipeline.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_user_agent_policy.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/test_utils.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/__init__.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/basic.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/encoding.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/errors.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/headers.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/structures.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/urlencoded.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/coretestserver/test_routes/xml_route.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/testserver_tests/coretestserver/setup.py +0 -0
- {corehttp-1.0.0b5 → corehttp-1.0.0b7}/tests/utils.py +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Release History
|
|
2
|
+
|
|
3
|
+
## 1.0.0b7 (2026-02-05)
|
|
4
|
+
|
|
5
|
+
### Features Added
|
|
6
|
+
|
|
7
|
+
- Native tracing support was added. [#39172](https://github.com/Azure/azure-sdk-for-python/pull/39172)
|
|
8
|
+
- The `OpenTelemetryTracer` class was added to the `corehttp.instrumentation.tracing.opentelemetry` module. This is a wrapper around the OpenTelemetry tracer that is used to create spans for SDK operations.
|
|
9
|
+
- Added a `get_tracer` method to the new `corehttp.instrumentation` module. This method returns an instance of the `OpenTelemetryTracer` class if OpenTelemetry is available.
|
|
10
|
+
- A `TracingOptions` TypedDict class was added to define the options that SDK users can use to configure tracing per-operation. These options include the ability to enable or disable tracing and set additional attributes on spans.
|
|
11
|
+
- Example usage: `client.method(tracing_options={"enabled": True, "attributes": {"foo": "bar"}})`
|
|
12
|
+
- `DistributedHttpTracingPolicy` and `distributed_trace`/`distributed_trace_async` decorators were added to support OpenTelemetry tracing for SDK operations.
|
|
13
|
+
- SDK clients can define an `_instrumentation_config` class variable to configure the OpenTelemetry tracer used in method span creation. Possible configuration options are `library_name`, `library_version`, `schema_url`, and `attributes`.
|
|
14
|
+
- Added a global settings object, `corehttp.settings`, to the `corehttp` package. This object can be used to set global settings for the `corehttp` package. Currently the only setting is `tracing_enabled` for enabling/disabling tracing. [#39172](https://github.com/Azure/azure-sdk-for-python/pull/39172)
|
|
15
|
+
- Added `start_time` and `context` keyword arguments to `OpenTelemetryTracer.start_span` and `start_as_current_span` methods.
|
|
16
|
+
- Added `set_span_error_status` static method to `OpenTelemetryTracer` for setting a span's status to ERROR.
|
|
17
|
+
- Added `is_generated_model`, `attribute_list`, and `TypeHandlerRegistry` to `corehttp.serialization` module for SDK model handling.
|
|
18
|
+
|
|
19
|
+
### Bugs Fixed
|
|
20
|
+
|
|
21
|
+
- Fixed `retry_backoff_max` being ignored in retry policies when configuring retries.
|
|
22
|
+
- Raise correct exception if transport is used while already closed.
|
|
23
|
+
- A timeout error when using the `aiohttp` transport will now be raised as a `corehttp.exceptions.ServiceResponseTimeoutError`, a subtype of the previously raised `ServiceResponseError`.
|
|
24
|
+
- When using with `aiohttp` 3.10 or later, a connection timeout error will now be raised as a `corehttp.exceptions.ServiceRequestTimeoutError`, which can be retried.
|
|
25
|
+
- Fixed leaked requests and aiohttp exceptions for streamed responses.
|
|
26
|
+
- Improved granularity of `ServiceRequestError` and `ServiceResponseError` exceptions raised in timeout scenarios from the requests and aiohttp transports.
|
|
27
|
+
- `BearerTokenCredentialPolicy` and `AsyncBearerTokenCredentialPolicy` will now properly chain exceptions raised during claims challenge handling. If a credential raises an exception when attempting to acquire a token in response to a claims challenge, that exception will be raised with the original 401 response as the cause.
|
|
28
|
+
|
|
29
|
+
### Other Changes
|
|
30
|
+
|
|
31
|
+
- Added `opentelemetry-api` as an optional dependency for tracing. [#39172](https://github.com/Azure/azure-sdk-for-python/pull/39172)
|
|
32
|
+
|
|
33
|
+
## 1.0.0b6 (2025-03-27)
|
|
34
|
+
|
|
35
|
+
### Features Added
|
|
36
|
+
|
|
37
|
+
- The `TokenCredential` and `AsyncTokenCredential` protocols have been updated to include a new `get_token_info` method. This method should be used to acquire tokens and return an `AccessTokenInfo` object. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
38
|
+
- Added a new `TokenRequestOptions` class, which is a `TypedDict` with optional parameters, that can be used to define options for token requests through the `get_token_info` method. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
39
|
+
- Added a new `AccessTokenInfo` class, which is returned by `get_token_info` implementations. This class contains the token, its expiration time, and optional additional information like when a token should be refreshed. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
40
|
+
- `BearerTokenCredentialPolicy` and `AsyncBearerTokenCredentialPolicy` now check if a credential has the `get_token_info` method defined. If so, the `get_token_info` method is used to acquire a token. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
41
|
+
- These policies now also check the `refresh_on` attribute when determining if a new token request should be made.
|
|
42
|
+
- Added `model` attribute to `HttpResponseError` to allow accessing error attributes based on a known model. [#39636](https://github.com/Azure/azure-sdk-for-python/pull/39636)
|
|
43
|
+
- Added `auth_flows` support in `BearerTokenCredentialPolicy`. [#40084](https://github.com/Azure/azure-sdk-for-python/pull/40084)
|
|
44
|
+
|
|
45
|
+
### Breaking Changes
|
|
46
|
+
|
|
47
|
+
- The `get_token` method has been removed from the `TokenCredential` and `AsyncTokenCredential` protocols. Implementations should now use the new `get_token_info` method to acquire tokens. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
48
|
+
- The `AccessToken` class has been removed and replaced with a new `AccessTokenInfo` class. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
49
|
+
- `BearerTokenCredentialPolicy` and `AsyncBearerTokenCredentialPolicy` now rely on credentials having the `get_token_info` method defined. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
50
|
+
|
|
51
|
+
## 1.0.0b5 (2024-02-29)
|
|
52
|
+
|
|
53
|
+
### Other Changes
|
|
54
|
+
|
|
55
|
+
- Accept float for `retry_after` header.
|
|
56
|
+
|
|
57
|
+
## 1.0.0b4 (2024-02-23)
|
|
58
|
+
|
|
59
|
+
### Other Changes
|
|
60
|
+
|
|
61
|
+
- Relax type checking in `Pipeline` constructors to only check that each user-supplied policy object has either a `send` method or both an `on_request` and `on_response` method. This allows for more flexible policy implementations. [#34296](https://github.com/Azure/azure-sdk-for-python/pull/34296)
|
|
62
|
+
|
|
63
|
+
## 1.0.0b3 (2024-02-01)
|
|
64
|
+
|
|
65
|
+
### Features Added
|
|
66
|
+
|
|
67
|
+
- Support tuple input for `files` values to `corehttp.rest.HttpRequest` #34082
|
|
68
|
+
- Support simultaneous `files` and `data` field entry into `corehttp.rest.HttpRequest` #34082
|
|
69
|
+
|
|
70
|
+
## 1.0.0b2 (2023-11-14)
|
|
71
|
+
|
|
72
|
+
### Features Added
|
|
73
|
+
|
|
74
|
+
- Added the initial implementation of the HTTPX transport. [#32813](https://github.com/Azure/azure-sdk-for-python/pull/32813)
|
|
75
|
+
|
|
76
|
+
### Breaking Changes
|
|
77
|
+
|
|
78
|
+
- Removed `requests` as a default dependency of `corehttp`. This is now an "extras" dependency and can be installed via `corehttp[requests]`. [#32813](https://github.com/Azure/azure-sdk-for-python/pull/32813)
|
|
79
|
+
- Renamed the `aio` extra to `aiohttp`. [#32813](https://github.com/Azure/azure-sdk-for-python/pull/32813)
|
|
80
|
+
|
|
81
|
+
### Bugs Fixed
|
|
82
|
+
|
|
83
|
+
- Fixed an issue with `multipart/form-data` in the async transport where `data` was not getting encoded into the request body. [#32473](https://github.com/Azure/azure-sdk-for-python/pull/32473)
|
|
84
|
+
- Fixed an issue with `connection_verify`, `connection_cert`, and `connection_timeout` not being propagated to underlying transports. [#33057](https://github.com/Azure/azure-sdk-for-python/pull/33057)
|
|
85
|
+
- Fixed an issue with the `aiohttp` transport not using SSL by default. [#33057](https://github.com/Azure/azure-sdk-for-python/pull/33057)
|
|
86
|
+
|
|
87
|
+
### Other Changes
|
|
88
|
+
|
|
89
|
+
- Added extras for `httpx`. [#32813](https://github.com/Azure/azure-sdk-for-python/pull/32813)
|
|
90
|
+
|
|
91
|
+
## 1.0.0b1 (2023-10-18)
|
|
92
|
+
|
|
93
|
+
* Initial Release
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: corehttp
|
|
3
|
+
Version: 1.0.0b7
|
|
4
|
+
Summary: CoreHTTP Library for Python
|
|
5
|
+
Home-page: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/corehttp
|
|
6
|
+
Author: Microsoft Corporation
|
|
7
|
+
Author-email: azpysdkhelp@microsoft.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Keywords: typespec,core
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: typing-extensions>=4.6.0
|
|
25
|
+
Provides-Extra: requests
|
|
26
|
+
Requires-Dist: requests>=2.18.4; extra == "requests"
|
|
27
|
+
Provides-Extra: aiohttp
|
|
28
|
+
Requires-Dist: aiohttp>=3.0; extra == "aiohttp"
|
|
29
|
+
Provides-Extra: httpx
|
|
30
|
+
Requires-Dist: httpx>=0.25.0; extra == "httpx"
|
|
31
|
+
Provides-Extra: tracing
|
|
32
|
+
Requires-Dist: opentelemetry-api~=1.26; extra == "tracing"
|
|
33
|
+
Dynamic: author
|
|
34
|
+
Dynamic: author-email
|
|
35
|
+
Dynamic: classifier
|
|
36
|
+
Dynamic: description
|
|
37
|
+
Dynamic: description-content-type
|
|
38
|
+
Dynamic: home-page
|
|
39
|
+
Dynamic: keywords
|
|
40
|
+
Dynamic: license
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
Dynamic: provides-extra
|
|
43
|
+
Dynamic: requires-dist
|
|
44
|
+
Dynamic: requires-python
|
|
45
|
+
Dynamic: summary
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Core HTTP shared client library for Python
|
|
49
|
+
|
|
50
|
+
`corehttp` provides shared exceptions and modules for Python SDK client libraries.
|
|
51
|
+
|
|
52
|
+
## Getting started
|
|
53
|
+
|
|
54
|
+
Typically, you will not need to install `corehttp`, as it will be installed when you install one of the client libraries using it.
|
|
55
|
+
|
|
56
|
+
### Transports
|
|
57
|
+
|
|
58
|
+
To use `corehttp`, you will need to choose a transport implementation. `corehttp` provides the following transports:
|
|
59
|
+
|
|
60
|
+
Synchronous transports:
|
|
61
|
+
- `RequestsTransport` - A synchronous transport based on the [Requests](https://requests.readthedocs.io/en/master/) library.
|
|
62
|
+
- `HttpXTransport` - An synchronous transport based on the [HTTPX](https://www.python-httpx.org/) library.
|
|
63
|
+
|
|
64
|
+
Asynchronous transports:
|
|
65
|
+
- `AioHttpTransport` - An asynchronous transport based on the [aiohttp](https://docs.aiohttp.org/en/stable/) library.
|
|
66
|
+
- `AsyncHttpXTransport` - An asynchronous transport based on the [HTTPX](https://www.python-httpx.org/) library.
|
|
67
|
+
|
|
68
|
+
Each transport has its own dependencies, which you can install using the `corehttp` extras:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Install individually.
|
|
72
|
+
pip install corehttp[requests]
|
|
73
|
+
pip install corehttp[aiohttp]
|
|
74
|
+
pip install corehttp[httpx]
|
|
75
|
+
|
|
76
|
+
# Install multiple.
|
|
77
|
+
pip install corehttp[requests,httpx]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If no transports are specified, `corehttp` will default to using `RequestsTransport` for synchronous pipeline requests and `AioHttpTransport` for asynchronous pipeline requests.
|
|
81
|
+
|
|
82
|
+
## Contributing
|
|
83
|
+
|
|
84
|
+
This project welcomes contributions and suggestions. Most contributions require
|
|
85
|
+
you to agree to a Contributor License Agreement (CLA) declaring that you have
|
|
86
|
+
the right to, and actually do, grant us the rights to use your contribution.
|
|
87
|
+
For details, visit [https://cla.microsoft.com](https://cla.microsoft.com).
|
|
88
|
+
|
|
89
|
+
When you submit a pull request, a CLA-bot will automatically determine whether
|
|
90
|
+
you need to provide a CLA and decorate the PR appropriately (e.g., label,
|
|
91
|
+
comment). Simply follow the instructions provided by the bot. You will only
|
|
92
|
+
need to do this once across all repos using our CLA.
|
|
93
|
+
|
|
94
|
+
This project has adopted the
|
|
95
|
+
[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
96
|
+
For more information, see the
|
|
97
|
+
[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
|
98
|
+
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any
|
|
99
|
+
additional questions or comments.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# Release History
|
|
105
|
+
|
|
106
|
+
## 1.0.0b7 (2026-02-05)
|
|
107
|
+
|
|
108
|
+
### Features Added
|
|
109
|
+
|
|
110
|
+
- Native tracing support was added. [#39172](https://github.com/Azure/azure-sdk-for-python/pull/39172)
|
|
111
|
+
- The `OpenTelemetryTracer` class was added to the `corehttp.instrumentation.tracing.opentelemetry` module. This is a wrapper around the OpenTelemetry tracer that is used to create spans for SDK operations.
|
|
112
|
+
- Added a `get_tracer` method to the new `corehttp.instrumentation` module. This method returns an instance of the `OpenTelemetryTracer` class if OpenTelemetry is available.
|
|
113
|
+
- A `TracingOptions` TypedDict class was added to define the options that SDK users can use to configure tracing per-operation. These options include the ability to enable or disable tracing and set additional attributes on spans.
|
|
114
|
+
- Example usage: `client.method(tracing_options={"enabled": True, "attributes": {"foo": "bar"}})`
|
|
115
|
+
- `DistributedHttpTracingPolicy` and `distributed_trace`/`distributed_trace_async` decorators were added to support OpenTelemetry tracing for SDK operations.
|
|
116
|
+
- SDK clients can define an `_instrumentation_config` class variable to configure the OpenTelemetry tracer used in method span creation. Possible configuration options are `library_name`, `library_version`, `schema_url`, and `attributes`.
|
|
117
|
+
- Added a global settings object, `corehttp.settings`, to the `corehttp` package. This object can be used to set global settings for the `corehttp` package. Currently the only setting is `tracing_enabled` for enabling/disabling tracing. [#39172](https://github.com/Azure/azure-sdk-for-python/pull/39172)
|
|
118
|
+
- Added `start_time` and `context` keyword arguments to `OpenTelemetryTracer.start_span` and `start_as_current_span` methods.
|
|
119
|
+
- Added `set_span_error_status` static method to `OpenTelemetryTracer` for setting a span's status to ERROR.
|
|
120
|
+
- Added `is_generated_model`, `attribute_list`, and `TypeHandlerRegistry` to `corehttp.serialization` module for SDK model handling.
|
|
121
|
+
|
|
122
|
+
### Bugs Fixed
|
|
123
|
+
|
|
124
|
+
- Fixed `retry_backoff_max` being ignored in retry policies when configuring retries.
|
|
125
|
+
- Raise correct exception if transport is used while already closed.
|
|
126
|
+
- A timeout error when using the `aiohttp` transport will now be raised as a `corehttp.exceptions.ServiceResponseTimeoutError`, a subtype of the previously raised `ServiceResponseError`.
|
|
127
|
+
- When using with `aiohttp` 3.10 or later, a connection timeout error will now be raised as a `corehttp.exceptions.ServiceRequestTimeoutError`, which can be retried.
|
|
128
|
+
- Fixed leaked requests and aiohttp exceptions for streamed responses.
|
|
129
|
+
- Improved granularity of `ServiceRequestError` and `ServiceResponseError` exceptions raised in timeout scenarios from the requests and aiohttp transports.
|
|
130
|
+
- `BearerTokenCredentialPolicy` and `AsyncBearerTokenCredentialPolicy` will now properly chain exceptions raised during claims challenge handling. If a credential raises an exception when attempting to acquire a token in response to a claims challenge, that exception will be raised with the original 401 response as the cause.
|
|
131
|
+
|
|
132
|
+
### Other Changes
|
|
133
|
+
|
|
134
|
+
- Added `opentelemetry-api` as an optional dependency for tracing. [#39172](https://github.com/Azure/azure-sdk-for-python/pull/39172)
|
|
135
|
+
|
|
136
|
+
## 1.0.0b6 (2025-03-27)
|
|
137
|
+
|
|
138
|
+
### Features Added
|
|
139
|
+
|
|
140
|
+
- The `TokenCredential` and `AsyncTokenCredential` protocols have been updated to include a new `get_token_info` method. This method should be used to acquire tokens and return an `AccessTokenInfo` object. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
141
|
+
- Added a new `TokenRequestOptions` class, which is a `TypedDict` with optional parameters, that can be used to define options for token requests through the `get_token_info` method. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
142
|
+
- Added a new `AccessTokenInfo` class, which is returned by `get_token_info` implementations. This class contains the token, its expiration time, and optional additional information like when a token should be refreshed. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
143
|
+
- `BearerTokenCredentialPolicy` and `AsyncBearerTokenCredentialPolicy` now check if a credential has the `get_token_info` method defined. If so, the `get_token_info` method is used to acquire a token. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
144
|
+
- These policies now also check the `refresh_on` attribute when determining if a new token request should be made.
|
|
145
|
+
- Added `model` attribute to `HttpResponseError` to allow accessing error attributes based on a known model. [#39636](https://github.com/Azure/azure-sdk-for-python/pull/39636)
|
|
146
|
+
- Added `auth_flows` support in `BearerTokenCredentialPolicy`. [#40084](https://github.com/Azure/azure-sdk-for-python/pull/40084)
|
|
147
|
+
|
|
148
|
+
### Breaking Changes
|
|
149
|
+
|
|
150
|
+
- The `get_token` method has been removed from the `TokenCredential` and `AsyncTokenCredential` protocols. Implementations should now use the new `get_token_info` method to acquire tokens. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
151
|
+
- The `AccessToken` class has been removed and replaced with a new `AccessTokenInfo` class. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
152
|
+
- `BearerTokenCredentialPolicy` and `AsyncBearerTokenCredentialPolicy` now rely on credentials having the `get_token_info` method defined. [#38346](https://github.com/Azure/azure-sdk-for-python/pull/38346)
|
|
153
|
+
|
|
154
|
+
## 1.0.0b5 (2024-02-29)
|
|
155
|
+
|
|
156
|
+
### Other Changes
|
|
157
|
+
|
|
158
|
+
- Accept float for `retry_after` header.
|
|
159
|
+
|
|
160
|
+
## 1.0.0b4 (2024-02-23)
|
|
161
|
+
|
|
162
|
+
### Other Changes
|
|
163
|
+
|
|
164
|
+
- Relax type checking in `Pipeline` constructors to only check that each user-supplied policy object has either a `send` method or both an `on_request` and `on_response` method. This allows for more flexible policy implementations. [#34296](https://github.com/Azure/azure-sdk-for-python/pull/34296)
|
|
165
|
+
|
|
166
|
+
## 1.0.0b3 (2024-02-01)
|
|
167
|
+
|
|
168
|
+
### Features Added
|
|
169
|
+
|
|
170
|
+
- Support tuple input for `files` values to `corehttp.rest.HttpRequest` #34082
|
|
171
|
+
- Support simultaneous `files` and `data` field entry into `corehttp.rest.HttpRequest` #34082
|
|
172
|
+
|
|
173
|
+
## 1.0.0b2 (2023-11-14)
|
|
174
|
+
|
|
175
|
+
### Features Added
|
|
176
|
+
|
|
177
|
+
- Added the initial implementation of the HTTPX transport. [#32813](https://github.com/Azure/azure-sdk-for-python/pull/32813)
|
|
178
|
+
|
|
179
|
+
### Breaking Changes
|
|
180
|
+
|
|
181
|
+
- Removed `requests` as a default dependency of `corehttp`. This is now an "extras" dependency and can be installed via `corehttp[requests]`. [#32813](https://github.com/Azure/azure-sdk-for-python/pull/32813)
|
|
182
|
+
- Renamed the `aio` extra to `aiohttp`. [#32813](https://github.com/Azure/azure-sdk-for-python/pull/32813)
|
|
183
|
+
|
|
184
|
+
### Bugs Fixed
|
|
185
|
+
|
|
186
|
+
- Fixed an issue with `multipart/form-data` in the async transport where `data` was not getting encoded into the request body. [#32473](https://github.com/Azure/azure-sdk-for-python/pull/32473)
|
|
187
|
+
- Fixed an issue with `connection_verify`, `connection_cert`, and `connection_timeout` not being propagated to underlying transports. [#33057](https://github.com/Azure/azure-sdk-for-python/pull/33057)
|
|
188
|
+
- Fixed an issue with the `aiohttp` transport not using SSL by default. [#33057](https://github.com/Azure/azure-sdk-for-python/pull/33057)
|
|
189
|
+
|
|
190
|
+
### Other Changes
|
|
191
|
+
|
|
192
|
+
- Added extras for `httpx`. [#32813](https://github.com/Azure/azure-sdk-for-python/pull/32813)
|
|
193
|
+
|
|
194
|
+
## 1.0.0b1 (2023-10-18)
|
|
195
|
+
|
|
196
|
+
* Initial Release
|
|
@@ -5,38 +5,74 @@
|
|
|
5
5
|
# -------------------------------------------------------------------------
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
from types import TracebackType
|
|
8
|
-
from typing import
|
|
8
|
+
from typing import NamedTuple, Optional, AsyncContextManager, Type, TypedDict, ContextManager
|
|
9
9
|
from typing_extensions import Protocol, runtime_checkable
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class
|
|
13
|
-
"""
|
|
12
|
+
class AccessTokenInfo:
|
|
13
|
+
"""Information about an OAuth access token.
|
|
14
|
+
|
|
15
|
+
:param str token: The token string.
|
|
16
|
+
:param int expires_on: The token's expiration time in Unix time.
|
|
17
|
+
:keyword str token_type: The type of access token. Defaults to 'Bearer'.
|
|
18
|
+
:keyword int refresh_on: Specifies the time, in Unix time, when the cached token should be proactively
|
|
19
|
+
refreshed. Optional.
|
|
20
|
+
"""
|
|
14
21
|
|
|
15
22
|
token: str
|
|
23
|
+
"""The token string."""
|
|
16
24
|
expires_on: int
|
|
25
|
+
"""The token's expiration time in Unix time."""
|
|
26
|
+
token_type: str
|
|
27
|
+
"""The type of access token."""
|
|
28
|
+
refresh_on: Optional[int]
|
|
29
|
+
"""Specifies the time, in Unix time, when the cached token should be proactively refreshed. Optional."""
|
|
30
|
+
|
|
31
|
+
def __init__(
|
|
32
|
+
self, token: str, expires_on: int, *, token_type: str = "Bearer", refresh_on: Optional[int] = None
|
|
33
|
+
) -> None:
|
|
34
|
+
self.token = token
|
|
35
|
+
self.expires_on = expires_on
|
|
36
|
+
self.token_type = token_type
|
|
37
|
+
self.refresh_on = refresh_on
|
|
17
38
|
|
|
39
|
+
def __repr__(self) -> str:
|
|
40
|
+
return "AccessTokenInfo(token='{}', expires_on={}, token_type='{}', refresh_on={})".format(
|
|
41
|
+
self.token, self.expires_on, self.token_type, self.refresh_on
|
|
42
|
+
)
|
|
18
43
|
|
|
19
|
-
AccessToken.token.__doc__ = """The token string."""
|
|
20
|
-
AccessToken.expires_on.__doc__ = """The token's expiration time in Unix time."""
|
|
21
44
|
|
|
45
|
+
class TokenRequestOptions(TypedDict, total=False):
|
|
46
|
+
"""Options to use for access token requests. All parameters are optional."""
|
|
22
47
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
48
|
+
claims: str
|
|
49
|
+
"""Additional claims required in the token, such as those returned in a resource provider's claims
|
|
50
|
+
challenge following an authorization failure."""
|
|
51
|
+
tenant_id: str
|
|
52
|
+
"""The tenant ID to include in the token request."""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class TokenCredential(Protocol, ContextManager["TokenCredential"]):
|
|
56
|
+
"""Protocol for classes able to provide OAuth access tokens."""
|
|
26
57
|
|
|
27
|
-
def
|
|
58
|
+
def get_token_info(self, *scopes: str, options: Optional[TokenRequestOptions] = None) -> AccessTokenInfo:
|
|
28
59
|
"""Request an access token for `scopes`.
|
|
29
60
|
|
|
30
61
|
:param str scopes: The type of access needed.
|
|
62
|
+
:keyword options: A dictionary of options for the token request. Unknown options will be ignored. Optional.
|
|
63
|
+
:paramtype options: TokenRequestOptions
|
|
31
64
|
|
|
32
|
-
:
|
|
33
|
-
|
|
65
|
+
:rtype: AccessTokenInfo
|
|
66
|
+
:return: An AccessTokenInfo instance containing information about the token.
|
|
67
|
+
"""
|
|
68
|
+
...
|
|
34
69
|
|
|
70
|
+
def close(self) -> None:
|
|
71
|
+
"""Close the credential, releasing any resources it holds.
|
|
35
72
|
|
|
36
|
-
:
|
|
37
|
-
:
|
|
73
|
+
:return: None
|
|
74
|
+
:rtype: None
|
|
38
75
|
"""
|
|
39
|
-
...
|
|
40
76
|
|
|
41
77
|
|
|
42
78
|
class ServiceNamedKey(NamedTuple):
|
|
@@ -47,10 +83,11 @@ class ServiceNamedKey(NamedTuple):
|
|
|
47
83
|
|
|
48
84
|
|
|
49
85
|
__all__ = [
|
|
50
|
-
"
|
|
86
|
+
"AccessTokenInfo",
|
|
51
87
|
"ServiceKeyCredential",
|
|
52
88
|
"ServiceNamedKeyCredential",
|
|
53
89
|
"TokenCredential",
|
|
90
|
+
"TokenRequestOptions",
|
|
54
91
|
"AsyncTokenCredential",
|
|
55
92
|
]
|
|
56
93
|
|
|
@@ -60,7 +97,7 @@ class ServiceKeyCredential:
|
|
|
60
97
|
It provides the ability to update the key without creating a new client.
|
|
61
98
|
|
|
62
99
|
:param str key: The key used to authenticate to a service
|
|
63
|
-
:raises:
|
|
100
|
+
:raises TypeError: If the key is not a string.
|
|
64
101
|
"""
|
|
65
102
|
|
|
66
103
|
def __init__(self, key: str) -> None:
|
|
@@ -84,7 +121,8 @@ class ServiceKeyCredential:
|
|
|
84
121
|
to update long-lived clients.
|
|
85
122
|
|
|
86
123
|
:param str key: The key used to authenticate to a service
|
|
87
|
-
:raises
|
|
124
|
+
:raises ValueError: If the key is None or empty.
|
|
125
|
+
:raises TypeError: If the key is not a string.
|
|
88
126
|
"""
|
|
89
127
|
if not key:
|
|
90
128
|
raise ValueError("The key used for updating can not be None or empty")
|
|
@@ -99,7 +137,7 @@ class ServiceNamedKeyCredential:
|
|
|
99
137
|
|
|
100
138
|
:param str name: The name of the credential used to authenticate to a service.
|
|
101
139
|
:param str key: The key used to authenticate to a service.
|
|
102
|
-
:raises:
|
|
140
|
+
:raises TypeError: If the name or key is not a string.
|
|
103
141
|
"""
|
|
104
142
|
|
|
105
143
|
def __init__(self, name: str, key: str) -> None:
|
|
@@ -134,21 +172,24 @@ class ServiceNamedKeyCredential:
|
|
|
134
172
|
class AsyncTokenCredential(Protocol, AsyncContextManager["AsyncTokenCredential"]):
|
|
135
173
|
"""Protocol for classes able to provide OAuth tokens."""
|
|
136
174
|
|
|
137
|
-
async def
|
|
175
|
+
async def get_token_info(self, *scopes: str, options: Optional[TokenRequestOptions] = None) -> AccessTokenInfo:
|
|
138
176
|
"""Request an access token for `scopes`.
|
|
139
177
|
|
|
140
178
|
:param str scopes: The type of access needed.
|
|
179
|
+
:keyword options: A dictionary of options for the token request. Unknown options will be ignored. Optional.
|
|
180
|
+
:paramtype options: TokenRequestOptions
|
|
141
181
|
|
|
142
|
-
:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
:rtype: AccessToken
|
|
146
|
-
:return: An AccessToken instance containing the token string and its expiration time in Unix time.
|
|
182
|
+
:rtype: AccessTokenInfo
|
|
183
|
+
:return: An AccessTokenInfo instance containing the token string and its expiration time in Unix time.
|
|
147
184
|
"""
|
|
148
185
|
...
|
|
149
186
|
|
|
150
187
|
async def close(self) -> None:
|
|
151
|
-
|
|
188
|
+
"""Close the credential, releasing any resources.
|
|
189
|
+
|
|
190
|
+
:return: None
|
|
191
|
+
:rtype: None
|
|
192
|
+
"""
|
|
152
193
|
|
|
153
194
|
async def __aexit__(
|
|
154
195
|
self,
|
|
@@ -72,15 +72,12 @@ class _HttpResponseCommonAPI(Protocol):
|
|
|
72
72
|
"""
|
|
73
73
|
|
|
74
74
|
@property
|
|
75
|
-
def reason(self) -> Optional[str]:
|
|
76
|
-
...
|
|
75
|
+
def reason(self) -> Optional[str]: ...
|
|
77
76
|
|
|
78
77
|
@property
|
|
79
|
-
def status_code(self) -> Optional[int]:
|
|
80
|
-
...
|
|
78
|
+
def status_code(self) -> Optional[int]: ...
|
|
81
79
|
|
|
82
|
-
def text(self) -> str:
|
|
83
|
-
...
|
|
80
|
+
def text(self) -> str: ...
|
|
84
81
|
|
|
85
82
|
@property
|
|
86
83
|
def request(self) -> object: # object as type, since all we need is str() on it
|
|
@@ -190,6 +187,8 @@ class HttpResponseError(BaseError):
|
|
|
190
187
|
:vartype status_code: int
|
|
191
188
|
:ivar response: The response that triggered the exception.
|
|
192
189
|
:vartype response: ~corehttp.rest.HttpResponse or ~corehttp.rest.AsyncHttpResponse
|
|
190
|
+
:ivar model: The response body model
|
|
191
|
+
:vartype model: Any
|
|
193
192
|
"""
|
|
194
193
|
|
|
195
194
|
def __init__(
|
|
@@ -203,6 +202,8 @@ class HttpResponseError(BaseError):
|
|
|
203
202
|
self.reason = response.reason
|
|
204
203
|
self.status_code = response.status_code
|
|
205
204
|
|
|
205
|
+
self.model: Optional[Any] = kwargs.pop("model", None)
|
|
206
|
+
|
|
206
207
|
# By priority, message is:
|
|
207
208
|
# - parameter "message", OR
|
|
208
209
|
# - generic message using "reason"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# ------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation.
|
|
3
|
+
# Licensed under the MIT License.
|
|
4
|
+
# ------------------------------------
|
|
5
|
+
from ._models import SpanKind, Link, TracingOptions
|
|
6
|
+
from ._decorator import distributed_trace, distributed_trace_async
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"Link",
|
|
10
|
+
"SpanKind",
|
|
11
|
+
"TracingOptions",
|
|
12
|
+
"distributed_trace",
|
|
13
|
+
"distributed_trace_async",
|
|
14
|
+
]
|