Metadata-Version: 2.1
Name: requests-ntlm2
Version: 6.0.12
Summary: The HTTP NTLM proxy and/or server authentication library.
Home-page: https://github.com/dopstar/requests-ntlm2
Author: Mkhanyisi Madlavana
Author-email: mmadlavana@gmail.com
License: ISC
Download-URL: https://github.com/dopstar/requests-ntlm2/archive/6.0.12.tar.gz
Keywords: NTLM,requests,proxy,authorization,NTLM dance
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: License :: OSI Approved :: ISC License (ISCL)
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: Software Development :: Version Control :: Git
Classifier: Programming Language :: Python :: Implementation :: CPython
Description-Content-Type: text/markdown
Requires-Dist: requests (>=2.0.0)
Requires-Dist: ntlm-auth (>=1.0.2)
Requires-Dist: cryptography (>=1.3)
Provides-Extra: linting
Requires-Dist: flake8 ; extra == 'linting'
Requires-Dist: bandit ; extra == 'linting'
Requires-Dist: flake8-isort ; extra == 'linting'
Requires-Dist: flake8-quotes ; extra == 'linting'
Provides-Extra: testing
Requires-Dist: flask ; extra == 'testing'
Requires-Dist: pytest ; extra == 'testing'
Requires-Dist: pytest-cov ; extra == 'testing'
Requires-Dist: wheel ; extra == 'testing'
Requires-Dist: codecov ; extra == 'testing'
Requires-Dist: coverage ; extra == 'testing'
Requires-Dist: mock ; extra == 'testing'
Requires-Dist: faker ; extra == 'testing'

# requests-ntlm2

[![Build Status](https://travis-ci.org/dopstar/requests-ntlm2.svg?branch=master)](https://travis-ci.org/dopstar/requests-ntlm2)
[![codecov](https://codecov.io/gh/dopstar/requests-ntlm2/branch/master/graph/badge.svg)](https://codecov.io/gh/dopstar/requests-ntlm2)
[![Python Version](https://img.shields.io/pypi/pyversions/requests-ntlm2.svg)](https://pypi.python.org/pypi/requests-ntlm2)
[![PyPI Status](https://img.shields.io/pypi/v/requests-ntlm2.svg)](https://pypi.python.org/pypi/requests-ntlm2)
[![Downloads](https://img.shields.io/pypi/dm/requests-ntlm2.svg)](https://pypi.python.org/pypi/requests-ntlm2)
[![Licence](https://img.shields.io/github/license/dopstar/requests-ntlm2.svg)](https://raw.githubusercontent.com/dopstar/requests-ntlm2/master/LICENSE)

requests-ntlm2, which is based on [requests-ntlm](https://github.com/requests/requests-ntlm) , allows for HTTP NTLM authentication using the requests library.

## Usage

### Basic Usage
`HttpNtlmAuth` extends requests `AuthBase`, so usage is simple:

```python
import requests
from requests_ntlm2 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.

```python
import requests
from requests_ntlm2 import HttpNtlmAuth

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

### HTTPS CONNECT Usage
When using `requests-ntlm2` 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:

```python
import requests
from requests_ntlm2 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

```shell
pip install requests-ntlm2
```

## Requirements

- [requests](https://github.com/kennethreitz/requests/)
- [ntlm-auth](https://github.com/jborean93/ntlm-auth)


