{"library":"requests-ntlm3","title":"Requests NTLMv2 Authentication","description":"A modern `requests` authentication handler for NTLM authentication, utilizing `pyspnego` for robust NTLMv1/v2 support, including both server and proxy authentication. This library is distinct from `requests-ntlm` and is compatible with Python 3 and modern NTLM implementations. It is actively maintained with a regular release cadence as needed for bug fixes and updates.","language":"python","status":"active","last_verified":"Sun May 17","install":{"commands":["pip install requests-ntlm3"],"cli":null},"imports":["from requests_ntlm3 import HttpNtlmAuth"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import requests\nimport os\nfrom requests_ntlm3 import HttpNtlmAuth\n\n# --- NTLM Server Authentication Example ---\n\nNTLM_USERNAME = os.environ.get('NTLM_SERVER_USERNAME', 'DOMAIN\\\\user')\nNTLM_PASSWORD = os.environ.get('NTLM_SERVER_PASSWORD', 'your_password')\nNTLM_SERVER_URL = os.environ.get('NTLM_SERVER_URL', 'http://localhost/protected')\n\nif NTLM_USERNAME and NTLM_PASSWORD and NTLM_SERVER_URL != 'http://localhost/protected':\n    try:\n        print(f\"Attempting NTLM server auth to {NTLM_SERVER_URL} with user {NTLM_USERNAME.split('\\\\')[-1]}...\")\n        response = requests.get(\n            NTLM_SERVER_URL,\n            auth=HttpNtlmAuth(NTLM_USERNAME, NTLM_PASSWORD)\n        )\n        response.raise_for_status()\n        print(f\"NTLM Server Auth Success: Status {response.status_code}, Length {len(response.text)}.\")\n    except requests.exceptions.RequestException as e:\n        print(f\"NTLM Server Auth Failed: {e}\")\nelse:\n    print(\"Skipping NTLM server auth example: Set NTLM_SERVER_USERNAME, NTLM_SERVER_PASSWORD, NTLM_SERVER_URL env vars.\")\n\n# --- NTLM Proxy Authentication Example ---\n\nPROXY_USERNAME = os.environ.get('NTLM_PROXY_USERNAME', 'DOMAIN\\\\proxyuser')\nPROXY_PASSWORD = os.environ.get('NTLM_PROXY_PASSWORD', 'proxy_password')\nPROXY_URL = os.environ.get('NTLM_PROXY_URL', 'http://your_proxy_server:8080')\nTARGET_URL_VIA_PROXY = os.environ.get('TARGET_URL_VIA_PROXY', 'http://www.example.com')\n\nif PROXY_USERNAME and PROXY_PASSWORD and PROXY_URL != 'http://your_proxy_server:8080':\n    proxies = {\n        \"http\": PROXY_URL,\n        \"https\": PROXY_URL # Use http for https proxy auth as well for NTLM proxies\n    }\n    try:\n        print(f\"Attempting NTLM proxy auth via {PROXY_URL} to {TARGET_URL_VIA_PROXY} with user {PROXY_USERNAME.split('\\\\')[-1]}...\")\n        response = requests.get(\n            TARGET_URL_VIA_PROXY,\n            proxies=proxies,\n            auth=HttpNtlmAuth(PROXY_USERNAME, PROXY_PASSWORD, ntlm_proxy_auth=True)\n        )\n        response.raise_for_status()\n        print(f\"NTLM Proxy Auth Success: Status {response.status_code}, Length {len(response.text)}.\")\n    except requests.exceptions.RequestException as e:\n        print(f\"NTLM Proxy Auth Failed: {e}\")\nelse:\n    print(\"Skipping NTLM proxy auth example: Set NTLM_PROXY_USERNAME, NTLM_PROXY_PASSWORD, NTLM_PROXY_URL, TARGET_URL_VIA_PROXY env vars.\")","lang":"python","description":"Demonstrates both NTLM server authentication and NTLM proxy authentication. For proxy authentication, ensure `ntlm_proxy_auth=True` is passed to `HttpNtlmAuth`. Environment variables are used for credentials and URLs to keep the example runnable without hardcoding sensitive data. Remember to replace placeholder values with your actual NTLM credentials and URLs.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-17","installed_version":"6.1.3b1","pypi_latest":"6.1.3b1","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.9,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"38.0M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.2,"import_time_s":null,"mem_mb":null,"disk_size":"38M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"40.4M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.8,"import_time_s":null,"mem_mb":null,"disk_size":"41M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"32.1M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"32M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"31.8M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"32M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"38.0M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"requests-ntlm3","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3.6,"import_time_s":null,"mem_mb":null,"disk_size":"38M"}]}}