Skip to main content

PyPI Python Version Pepy Total Downloads

httpx2-negotiate-sspi

httpx2-negotiate-sspi provides HTTP Negotiate authentication for httpx2 on Windows through the SSPI APIs exposed by pywin32.

It supports:

  • Kerberos and NTLM challenge handling
  • Single sign-on with the current Windows logon session
  • Explicit credentials when default credentials are not appropriate
  • Extended Protection for Authentication via TLS channel binding tokens

Platform support

This package is intended for Windows clients. It depends on Windows SSPI through pywin32, and its authentication flow is designed for services that advertise Negotiate or NTLM via WWW-Authenticate.

Installation

pip install httpx2-negotiate-sspi

Quick start

Use the logged-in Windows account for single sign-on:

import httpx2
from httpx2_negotiate_sspi import HttpNegotiateAuth

with httpx2.Client(auth=HttpNegotiateAuth()) as client:
    response = client.get("https://iis.contoso.com")
    response.raise_for_status()

Async clients use the same auth object:

import asyncio

import httpx2

from httpx2_negotiate_sspi import HttpNegotiateAuth


async def main() -> None:
    async with httpx2.AsyncClient(auth=HttpNegotiateAuth()) as client:
        response = await client.get("https://iis.contoso.com")
        response.raise_for_status()


asyncio.run(main())

Common configuration

Explicit credentials:

import getpass

import httpx2
from httpx2_negotiate_sspi import HttpNegotiateAuth

auth = HttpNegotiateAuth(
    "svc-http-client",
    getpass.getpass(),
    "CONTOSO",
)

with httpx2.Client(auth=auth) as client:
    response = client.get("https://iis.contoso.com")

Explicit SPN service and host override:

from httpx2_negotiate_sspi import HttpNegotiateAuth

auth = HttpNegotiateAuth(service="HTTP", host="adfs.contoso.com")

Delegation-enabled authentication:

from httpx2_negotiate_sspi import HttpNegotiateAuth

auth = HttpNegotiateAuth(delegate=True)

Configuration reference

HttpNegotiateAuth accepts these options:

  • username: User name for explicit credentials. Default: None.
  • password: Password for explicit credentials. Default: None.
  • domain: NT domain name used with explicit credentials. Default: "." for the local machine account namespace.
  • service: Kerberos service class used when constructing the SPN. Default: "HTTP".
  • host: Explicit SPN host override. When omitted, the request host is used and may be canonicalized through DNS per challenged request.
  • delegate: Enables ISC_REQ_DELEGATE so the server may receive delegated credentials. Default: False.

Behavior notes

  • If both username and password are omitted, the current Windows logon credentials are used.
  • If host is omitted, the SPN host is derived per request and the library attempts DNS canonicalization. If canonicalization fails, it falls back to the original request host.
  • When the httpx2 transport exposes an SSL object, the library sends a TLS channel binding token derived from the peer certificate. This is required by some services that enforce Extended Protection for Authentication.
  • If the outgoing request already contains an Authorization header, the Negotiate flow does not overwrite it.

Troubleshooting

  • If you keep receiving 401 Unauthorized, confirm the server is advertising Negotiate or NTLM and that the account has permission to access the service.
  • If Kerberos works only with an explicit host, verify that DNS canonicalization is resolving the expected SPN.
  • If a service requires Extended Protection, make sure the request is using TLS and that the transport exposes the peer certificate to httpx2.
  • If you are authenticating as another account, provide both username and password; specifying only one value leaves default credentials in use.

Documentation and development

To work on the project locally:

python -m pip install -e .[dev,doc]
python -m coverage run -m unittest discover -s tests
python -m coverage report -m --fail-under=100
python -m sphinx -W -b html docs docs/_build/html

Credits

This package was inspired by requests-negotiate-sspi.

Metadata

Release files for httpx2-negotiate-sspi 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for httpx2-negotiate-sspi 2.0.2
File Actions
httpx2_negotiate_sspi-2.0.2-cp315-cp315-win_amd64.whl CPython 3.15 CPython 3.15 Windows x86-64 Details for httpx2_negotiate_sspi-2.0.2-cp315-cp315-win_amd64.whl
httpx2_negotiate_sspi-2.0.2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for httpx2_negotiate_sspi-2.0.2-cp314-cp314-win_amd64.whl
httpx2_negotiate_sspi-2.0.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for httpx2_negotiate_sspi-2.0.2-cp313-cp313-win_amd64.whl
httpx2_negotiate_sspi-2.0.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for httpx2_negotiate_sspi-2.0.2-cp312-cp312-win_amd64.whl
httpx2_negotiate_sspi-2.0.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for httpx2_negotiate_sspi-2.0.2-cp311-cp311-win_amd64.whl
httpx2_negotiate_sspi-2.0.2-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for httpx2_negotiate_sspi-2.0.2-cp310-cp310-win_amd64.whl

Total release size: 81.1 kB

Release files / httpx2_negotiate_sspi-2.0.2-cp315-cp315-win_amd64.whl

Download URL httpx2_negotiate_sspi-2.0.2-cp315-cp315-win_amd64.whl
Size 13.5 kB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
c29f91212a26f5daa7c9ac05c1ecfc080a2e9808ad8ac68318e6842f1b847f7c
BLAKE2b-256 checksum
How to use checksums
5136ce9c02cfe7c436f0e04492bf372f0c961c6a417e0ec60c79633f50750cf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / httpx2_negotiate_sspi-2.0.2-cp314-cp314-win_amd64.whl

Download URL httpx2_negotiate_sspi-2.0.2-cp314-cp314-win_amd64.whl
Size 13.5 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
a7097c2a5d009ad1f6b385ecae338425502912b8d000038586b025dd33e29a39
BLAKE2b-256 checksum
How to use checksums
5cee5208447b921211ff087ced9bf2e9ace27243d9d5de07c733add93cce2599
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / httpx2_negotiate_sspi-2.0.2-cp313-cp313-win_amd64.whl

Download URL httpx2_negotiate_sspi-2.0.2-cp313-cp313-win_amd64.whl
Size 13.5 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
51dba4aa3b114f9555309ad5842e7035c5c1663ea82f0b281648a0cd14c28c26
BLAKE2b-256 checksum
How to use checksums
49a525cbe8dab0dfb0b809a07984a0851d117aa935cc81bd112df4985711eb39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / httpx2_negotiate_sspi-2.0.2-cp312-cp312-win_amd64.whl

Download URL httpx2_negotiate_sspi-2.0.2-cp312-cp312-win_amd64.whl
Size 13.5 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
9904cdc5fb78d346d9838aa366d9dd91c7d53c02b957f36fc9ebb502942de427
BLAKE2b-256 checksum
How to use checksums
0298476624b82a4062755898fac89ca3d7e126a57e1b96f92c3534c63fd0b435
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / httpx2_negotiate_sspi-2.0.2-cp311-cp311-win_amd64.whl

Download URL httpx2_negotiate_sspi-2.0.2-cp311-cp311-win_amd64.whl
Size 13.5 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
d7cb5434ebb7e612d2a5d45facdf7ccf0070744358dcf1350a54ad3e555d488d
BLAKE2b-256 checksum
How to use checksums
3eed44f53e2a20dcfd331fd7ee1310037e133d34b9d988a50f41cf0788d63c77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / httpx2_negotiate_sspi-2.0.2-cp310-cp310-win_amd64.whl

Download URL httpx2_negotiate_sspi-2.0.2-cp310-cp310-win_amd64.whl
Size 13.5 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
97d07d216b8fd93e5486f5aa3703f17b5184299ae55520586b661c4cabf4bb9a
BLAKE2b-256 checksum
How to use checksums
81673df899d59be89914c73d63c8190c2e3b10635563ace1ae2357af63f79420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for httpx2-negotiate-sspi 2.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for httpx2_negotiate_sspi-2.0.2-cp315-cp315-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.2 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page