[Identity] Update HttpRequest class usage#44993
Open
pvaneck wants to merge 1 commit intoAzure:mainfrom
Open
Conversation
This updates HttpRequest imports from azure.core.transport to use the HttpRequest class from azure.core.rest. The HttpRequest class from azure.core.transport is considered legacy. Updating this also enables the transports from `corehttp` to be used with azure-identity, including the `HttpxTransports`. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
ab7ff38 to
d279c13
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the azure-identity library to use the modern HttpRequest class from azure.core.rest instead of the legacy version from azure.core.pipeline.transport. This change enables compatibility with newer transport implementations from corehttp, including HttpxTransports.
Changes:
- Replaced all imports of HttpRequest from
azure.core.pipeline.transportwithazure.core.rest - Refactored HttpRequest instantiation to use the modern API (passing parameters directly to constructor instead of using methods like
format_parameters,set_formdata_body,set_bytes_body) - Updated documentation strings and type hints to reference the new import path
- Added CHANGELOG entry documenting the change
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/identity/azure-identity/tests/test_managed_identity_client_async.py | Updated HttpRequest import from legacy to modern API |
| sdk/identity/azure-identity/tests/test_managed_identity_client.py | Updated HttpRequest import from legacy to modern API |
| sdk/identity/azure-identity/tests/test_imds_credential_async.py | Updated HttpRequest import, kept HttpResponse from transport (correct) |
| sdk/identity/azure-identity/tests/test_imds_credential.py | Updated HttpRequest import, kept HttpResponse from transport (correct) |
| sdk/identity/azure-identity/tests/perfstress_tests/bearer_token_auth_policy.py | Updated HttpRequest import from legacy to modern API |
| sdk/identity/azure-identity/azure/identity/aio/_internal/aad_client.py | Updated HttpRequest import from legacy to modern API |
| sdk/identity/azure-identity/azure/identity/_internal/msal_client.py | Updated import and refactored to use modern HttpRequest constructor API, updated docstrings |
| sdk/identity/azure-identity/azure/identity/_internal/managed_identity_client.py | Updated HttpRequest import from legacy to modern API |
| sdk/identity/azure-identity/azure/identity/_internal/aad_client_base.py | Updated HttpRequest import from legacy to modern API |
| sdk/identity/azure-identity/azure/identity/_internal/aad_client.py | Updated HttpRequest import from legacy to modern API |
| sdk/identity/azure-identity/azure/identity/_credentials/service_fabric.py | Updated import and refactored to pass params directly to HttpRequest constructor |
| sdk/identity/azure-identity/azure/identity/_credentials/imds.py | Updated import and refactored to pass params directly to HttpRequest constructor |
| sdk/identity/azure-identity/azure/identity/_credentials/cloud_shell.py | Updated import and refactored to pass data directly to HttpRequest constructor |
| sdk/identity/azure-identity/azure/identity/_credentials/azure_ml.py | Updated import and refactored to pass params directly to HttpRequest constructor |
| sdk/identity/azure-identity/azure/identity/_credentials/azure_arc.py | Updated import and refactored to pass params directly to HttpRequest constructor |
| sdk/identity/azure-identity/azure/identity/_credentials/app_service.py | Updated import and refactored to pass params directly to HttpRequest constructor |
| sdk/identity/azure-identity/CHANGELOG.md | Added entry documenting the HttpRequest import change with PR reference |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates HttpRequest imports from azure.core.transport to use the HttpRequest class from azure.core.rest. The HttpRequest class from azure.core.transport is considered legacy.
Updating this also enables the transports from
corehttpto be used with azure-identity, including theHttpxTransports.