requests-negotiate-sspi

raw JSON →
0.5.3 verified Fri May 01 auth: no python

This package enables Single-Sign On HTTP Negotiate authentication (Kerberos/NTLM) using the requests library on Windows. Current version 0.5.3, low release cadence.

pip install requests-negotiate-sspi
error ModuleNotFoundError: No module named 'requests-negotiate-sspi'
cause Import path uses hyphens instead of underscores.
fix
Use 'import requests_negotiate_sspi' (underscores) in your code.
error ImportError: No module named win32security
cause Missing pywin32 dependency.
fix
Install pywin32: 'pip install pywin32'
error requests.exceptions.ConnectionError: Failed to authenticate with server
cause Service Principal Name (SPN) mismatch or server not configured for Negotiate auth.
fix
Ensure the URL uses the correct hostname matching the Kerberos SPN (HTTP/hostname@REALM).
gotcha This package only works on Windows because it uses Windows SSPI. It will fail with ImportError on Linux/macOS.
fix Use on Windows only, or wrap imports with platform detection.
deprecated The library is unmaintained; check for newer alternatives like requests-kerberos or requests-gssapi for cross-platform support.
fix Consider using requests-kerberos for non-Windows environments.
gotcha The imported package name uses underscores, not hyphens. Use 'import requests_negotiate_sspi' not 'requests-negotiate-sspi'.
fix Correct import: 'from requests_negotiate_sspi import HttpNegotiateAuth'.

Perform GET request with Negotiate authentication using SSPI on Windows.

import requests
from requests_negotiate_sspi import HttpNegotiateAuth

auth = HttpNegotiateAuth()
response = requests.get('http://example.com', auth=auth)
print(response.status_code)
print(response.text)