Skip to content

Commit

Permalink
Add ntlm2 support (#1)
Browse files Browse the repository at this point in the history
* Changed dependency of python-ntlm3 to ntlm-auth to support NTLMv2 authentication and the various features brought on by that. Fixed up test cases now we are using a newer version of NTLM. Added appveyor and travis-ci functionality for better testing

* Bumped ntlm-auth dependency for python 2.6 changes. Added background jobs to start the flask instance for both travis and appveyor

* trying to get appveyor working now

* more tests for coverage, appveyor still not working

* Adding __name__ to functional to get appveyor working. Now that we have more coverage have added more tests

* appveyor is working now, trying to get it to wait until flask is ready

* that didn't work, moving flask startup to before we configure IIS to give it time

* trying to get the tests working again

* trying different tactic for appveyor now

* hopefully the last, it worked locally

* removed Stop-Job in appveyor as the process will be killed at the end anyway

* Added wheel dependency for appveyor

* trying to fix up import errors for newer version of python

* let's see if this works

* I really don't like imports

* verify weird import issues, hopefully this will work

* trying to get powershell arguments right

* looks like quotes don't work normally, trying single quotes in quotes
  • Loading branch information
jborean93 committed Aug 29, 2016
1 parent ca026d3 commit fea4f5d
Show file tree
Hide file tree
Showing 20 changed files with 932 additions and 123 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ env/
build/
dist/
*.egg-info/
.idea
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
language: python

python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "3.5"

# command to install dependencies
install:
- python setup.py install
- pip install -r requirements.txt
- pip install python-coveralls

# start the Flask server for our tests
before_script:
- python -m tests.test_server &

# command to run tests
script:
- py.test --ignore=tests/functional/test_functional.py --ignore=tests/test_server.py --cov requests_ntlm --cov-report term-missing tests

after_success:
- coveralls

4 changes: 4 additions & 0 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ Contributors
- `Carson Lam`_

.. _Carson Lam: https://github.com/rbcarson

- `Jordan Borean`_

.. _Jordan Borean: https://github.com/jborean93
13 changes: 11 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
requests-ntlm
=============

.. image:: https://travis-ci.org/jborean93/requests-ntlm.svg?branch=master
:target: https://travis-ci.org/jborean93/requests-ntlm

.. image:: https://ci.appveyor.com/api/projects/status/stkl2dxwdhph3rju/branch/master?svg=true
:target: https://ci.appveyor.com/project/jborean93/requests-ntlm

.. image:: https://coveralls.io/repos/github/jborean93/requests-ntlm/badge.svg?branch=master
:target: https://coveralls.io/github/jborean93/requests-ntlm?branch=master

This package allows for HTTP NTLM authentication using the requests library.

Usage
Expand Down Expand Up @@ -38,10 +47,10 @@ Requirements
------------

- requests_
- python-ntlm3_
- ntlm-auth_

.. _requests: https://github.com/kennethreitz/requests/
.. _python-ntlm3: https://github.com/trustrachel/python-ntlm3
.. _ntlm-auth: https://github.com/jborean93/ntlm-auth

Authors
-------
Expand Down
106 changes: 106 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"

matrix:
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.x" # currently 2.7.9
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x" # currently 2.7.9
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python33"
PYTHON_VERSION: "3.3.x" # currently 3.3.5
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python33-x64"
PYTHON_VERSION: "3.3.x" # currently 3.3.5
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python34"
PYTHON_VERSION: "3.4.x" # currently 3.4.3
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.x" # currently 3.4.3
PYTHON_ARCH: "64"

# Python versions not pre-installed

- PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5.0"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.0"
PYTHON_ARCH: "64"

install:
# If there is a newer build queued for the same PR, cancel this one.
# The AppVeyor 'rollout builds' option is supposed to serve the same
# purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers.
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
- ECHO "Filesystem root:"
- ps: "ls \"C:/\""

- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""

# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
- ps: if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 }

# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"

# Check that we have the expected version and architecture for Python
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""

# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "pip install --disable-pip-version-check --user --upgrade pip"

# Install the build dependencies of the project. If some dependencies contain
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "%CMD_IN_ENV% pip install -r requirements.txt"

build: false

before_test:
# Start up the Flask test instance for the tests
- ps: "Start-Process -FilePath 'python.exe' -ArgumentList '-m tests.test_server'"
# Sets up 2 IIS sites to use in the integration tests only run on windows.
# This will actually test out NTLM authentication with a real client and not just documentation examples
- PowerShell appveyor\setup_iis.ps1

test_script:
# Run the project tests
- "%CMD_IN_ENV% py.test tests"

after_test:
- "%CMD_IN_ENV% python setup.py bdist_wheel bdist_wininst"
- ps: "ls dist"

artifacts:
- path: dist\*

matrix:
fast_finish: true

services:
- iis
Loading

0 comments on commit fea4f5d

Please sign in to comment.