chore: improve core http client usage - #346
Open
NicoleMGomes wants to merge 7 commits into
Open
NicoleMGomes wants to merge 7 commits into
NicoleMGomes wants to merge 7 commits into
Conversation
NicoleMGomes
force-pushed
the
chore/core-http-client-usage
branch
2 times, most recently
from
September 21, 2026 18:18
b13ebac to
8e39060
Compare
NicoleMGomes
force-pushed
the
chore/core-http-client-usage
branch
from
September 21, 2026 18:30
8e39060 to
1168297
Compare
NicoleMGomes
marked this pull request as ready for review
September 21, 2026 20:13
cassiofariasmachado
previously approved these changes
Sep 22, 2026
cassiofariasmachado
approved these changes
Sep 22, 2026
This branch has not been deployed
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.
Description
Replaces module-internal HTTP client implementations in the
printandauditlogmodules with the sharedHttpClient+XsuaaAuthProviderfromsap_cloud_sdk.core.protocol.http, consistent with howdmsalready works.Print service (
sap_cloud_sdk/print/_http.py,__init__.py):PrintHttppreviously held a rawrequests.Sessionand manually constructedAuthorizationheaders viaTokenProvider.get_token(). It now accepts anHttpClientinstance and delegates all auth and session management to it.TokenProvideris retained exclusively forresolve_username()— JWT claim decoding needed to auto-fillPrintTask.username.create_client()now wiresXsuaaAuthProvider(factory)→HttpClient(base_url, auth_provider)→PrintHttp.Audit Log (
sap_cloud_sdk/core/auditlog/_http_transport.py,config.py):HttpTransportpreviously managed its ownOAuth2Session, including token fetching, caching, and rotation detection in_ensure_session(). All of that is now handled byXsuaaAuthProviderinsideHttpClient.AuditLogConfiggained two computed properties —token_url(derivesoauth_url + /oauth/token) andbase_url(alias forservice_url) — so it satisfies the interface expected byXsuaaAuthProvider._ensure_session()method and theself.oauthattribute are removed.All changes are internal. No public API signatures were changed.
Related Issue
Closes #
Type of Change
How to Test
Checklist
Additional Notes
This is a follow-up to #332 (credential rotation support). Cassio's review on that PR noted that
printandauditlogstill used internal HTTP clients instead of the shared core one. This PR addresses that feedback.The
PrintHttp.__init__signature changed (configandsessionparameters removed,http_client: HttpClientadded), butPrintHttpis an internal class — it is not exported in__all__and is not part of the public API.