Registry / security / python-ntlm3

python-ntlm3

JSON →
library1.0.2pypypiunverified

Python 3 compatible NTLM authentication library. Provides NTLM hash generation and HTTP authentication support. Current version 1.0.2, last updated in 2018; maintenance mode.

pip install python-ntlm3
INSTALL
IMPORT
SIG · PYTHON-NTLM3
P
python-ntlm3
securitypythonv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ntlm
from ntlm import ntlm
import python_ntlm3
The package name on PyPI is python-ntlm3, but the import module is 'ntlm'.
NtlmAuthHandler
from ntlm import HTTPNtlmAuthHandler
from ntlm3 import HTTPNtlmAuthHandler
The correct module is 'ntlm', not 'ntlm3'.

Basic NTLM-authenticated HTTP request using urllib.

import urllib.request from ntlm import HTTPNtlmAuthHandler user = os.environ.get('NTLM_USER', 'DOMAIN\\user') password = os.environ.get('NTLM_PASSWORD', 'password') passman = urllib.request.HTTPPasswordMgrWithDefaultRealm() passman.add_password(None, "http://example.com", user, password) auth = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman) opener = urllib.request.build_opener(auth) urllib.request.install_opener(opener) response = urllib.request.urlopen("http://example.com") print(response.read())
Debug
Known issues
deprecatedThe library is no longer actively maintained; consider using requests-ntlm or httpx-ntlm for new projects.
fix
Switch to requests-ntlm (pip install requests_ntlm) and use requests library.
affects: >=1.0.0
gotchaImport module is 'ntlm', not 'python_ntlm3' or 'ntlm3'. Many users try to import the package name directly.
fix
Use 'import ntlm' or 'from ntlm import ...'
affects: all
breakingDomain separator in username: must be backslash (DOMAIN\user) in the password manager, not forward slash.
fix
Ensure domain and user are joined with double backslash (escaped) in Python string: 'DOMAIN\\user'.
affects: all
Upgrade
Version history
1.0.2latest on PyPI · released Jan 7, 2015
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
python-ntlm3 — pip install python-ntlm3 · libregistry