Skip to main content

The HTTP NTLM proxy and/or server authentication library.

Project description

requests-ntlm3

Build Status Python Version PyPI Status Downloads Licence

requests-ntlm3, which is based on requests-ntlm, allows for HTTP NTLM authentication using the requests library.

Usage

Basic Usage

HttpNtlmAuth extends requests AuthBase, so usage is simple:

import requests
from requests_ntlm3 import HttpNtlmAuth

auth=HttpNtlmAuth('domain\\username','password')
requests.get("http://ntlm_protected_site.com", auth=auth)

Using with Requests Session

HttpNtlmAuth can be used in conjunction with a Session in order to make use of connection pooling. Since NTLM authenticates connections, this is more efficient. Otherwise, each request will go through a new NTLM challenge-response.

import requests
from requests_ntlm3 import HttpNtlmAuth

session = requests.Session()
session.auth = HttpNtlmAuth('domain\\username','password')
session.get('http://ntlm_protected_site.com')

HTTPS CONNECT Usage

When using requests-ntlm3 to create SSL proxy tunnel via HTTPS CONNECT, the so-called "NTLM Dance" - ie, the NTLM authentication handshake - has to be done at the lower level (at httplib level) at tunnel-creation step. This means that you should use the HttpNtlmAdapter and requests session. This HttpNtlmAdapter is responsible for sending proxy auth information downstream.

Here is a basic example:

import requests
from requests_ntlm3 import HttpNtlmAuth, HttpNtlmAdapter

username = '...'
password = '...'
proxy_ip = '...'
proxy_port = '...'

proxies = {
    'http': 'http://{}:{}'.format(proxy_ip, proxy_port),
    'https': 'http://{}:{}'.format(proxy_ip, proxy_port)
}

url = 'http:/foobar.com'

session = requests.Session()
session.mount('https://', HttpNtlmAdapter(username, password))
session.mount('http://', HttpNtlmAdapter(username, password))
session.auth = HttpNtlmAuth(username, password)
session.proxies = proxies

response = session.get(url)

Installation

pip install requests-ntlm3

Requirements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests_ntlm3-6.0.11b1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distributions

requests_ntlm3-6.0.11b1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

requests_ntlm3-6.0.11b1-py2-none-any.whl (11.7 kB view details)

Uploaded Python 2

File details

Details for the file requests_ntlm3-6.0.11b1.tar.gz.

File metadata

  • Download URL: requests_ntlm3-6.0.11b1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.15

File hashes

Hashes for requests_ntlm3-6.0.11b1.tar.gz
Algorithm Hash digest
SHA256 f899377be14d14eaf4a365542a56e3ad5f4765ca5e0245567473be5c006ed878
MD5 5eaf7b7828adc6036c2616edcf170f14
BLAKE2b-256 cdaaad346110542ab07f0196de2336f87791777e7ac5da21ad971db106a21444

See more details on using hashes here.

File details

Details for the file requests_ntlm3-6.0.11b1-py3-none-any.whl.

File metadata

  • Download URL: requests_ntlm3-6.0.11b1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.5.6

File hashes

Hashes for requests_ntlm3-6.0.11b1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4a7c44acacdcc8b58d2a854ec7805738f067d2f713b46efdd25cf717d6ecc37
MD5 a59b27ced07ff4f31c36369b88cf4646
BLAKE2b-256 8e183b41b6bbbbc1bf8feeabe22da477a95a90a8b4ed681816aea27d12cf969c

See more details on using hashes here.

File details

Details for the file requests_ntlm3-6.0.11b1-py2-none-any.whl.

File metadata

  • Download URL: requests_ntlm3-6.0.11b1-py2-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.15

File hashes

Hashes for requests_ntlm3-6.0.11b1-py2-none-any.whl
Algorithm Hash digest
SHA256 8849ba2aa0dfc96e26669bf7e0032fc3ab73dab0ee7997cd942f3d890dc15800
MD5 55df67693259951ea7ebe363133333b4
BLAKE2b-256 e1f83b48bbcc9266aee69ed4ad151df8fee2c4669e4dedc31fb35245e18d7540

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page