Skip to content

fix: avoid httpx2 verify=<str> deprecation in the client auth patches#952

Open
chrisburr wants to merge 3 commits into
DIRACGrid:mainfrom
chrisburr:fix/httpx2-verify-deprecation
Open

fix: avoid httpx2 verify=<str> deprecation in the client auth patches#952
chrisburr wants to merge 3 commits into
DIRACGrid:mainfrom
chrisburr:fix/httpx2-verify-deprecation

Conversation

@chrisburr

Copy link
Copy Markdown
Member

Follow-up to #948. httpx2 deprecated verify=<str>, and the client passes a configured ca_path straight into httpx2.get/post, so the warning fires in normal use.

Fixed by converting the CA path to an ssl.SSLContext (new prepare_verify helper); the string form is kept only for azure-core's connection_verify.

Along the way: dropped the unused DiracClientMixin, and merged the duplicated token helpers in patches/utils.py + patches/client/common.py into one module (now typed bool | ssl.SSLContext).

httpx2 deprecated passing verify as a path string. The client credential
flow converts verify to a CA-bundle path when ca_path is configured and
passed it straight to httpx2.get/post, triggering a DeprecationWarning in
normal usage.

Add a prepare_verify helper in diracx.core.utils that builds an
ssl.SSLContext from a CA file/directory path (booleans pass through) and
use it at the httpx2 call sites in the sync and async client patches.
DiracClientMixin (and its DiracTokenCredential /
DiracBearerTokenCredentialPolicy helpers) in patches/utils.py were never
imported; the live clients are SyncDiracClient/AsyncDiracClient, which use
the per-mode mixins in patches/client/{sync,aio}.py. Remove the dead
classes and the imports that only they used.
patches/utils.py duplicated the token helpers already present in
patches/client/common.py; the async client used one copy and the sync
client the other. Merge them into patches/client/common.py (imported by
both sync.py and aio.py) and delete patches/utils.py.

With a single home for the helpers, flip their verify parameter to the
native httpx2 type (bool | ssl.SSLContext) and convert the CA path once in
each client __init__, keeping the bool/str form only for azure-core's
connection_verify.
@chrisburr chrisburr marked this pull request as ready for review June 17, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant