user3474649
user3474649

Reputation: 175

Python requests_ntlm import error

Hello i am receiving the following error when i try to import the requests_ntlm package. I installed the package with easy_install requests-ntlm. I am trying to use this library so that I can log onto an aspx.net webserver with www-authenticate: negotatiate NTLM response header using python. Appreciate any help solving this issue let me know if I need to provide more information. Thanks!

Traceback (most recent call last):
  File "SHS.py", line 2, in <module>
    from requests_ntlm import HttpNtlmAuth
  File "build\bdist.win-amd64\egg\requests_ntlm\__init__.py", line 1, in <module
>
  File "build\bdist.win-amd64\egg\requests_ntlm\requests_ntlm.py", line 4, in <m
odule>
  File "C:\python27\lib\site-packages\python_ntlm3-1.0.1-py2.7.egg\ntlm3\__init_
_.py", line 2, in <module>
    from . import HTTPNtlmAuthHandler  # noqa
  File "C:\python27\lib\site-packages\python_ntlm3-1.0.1-py2.7.egg\ntlm3\HTTPNtl
mAuthHandler.py", line 20, in <module>
    from . import ntlm
  File "C:\python27\lib\site-packages\python_ntlm3-1.0.1-py2.7.egg\ntlm3\ntlm.py
", line 25, in <module>
    from . import des
  File "C:\python27\lib\site-packages\python_ntlm3-1.0.1-py2.7.egg\ntlm3\des.py"
, line 19, in <module>
    from . import des_c
  File "C:\python27\lib\site-packages\python_ntlm3-1.0.1-py2.7.egg\ntlm3\des_c.p
y", line 19, in <module>
    from .des_data import des_SPtrans, des_skb
  File "C:\python27\lib\site-packages\python_ntlm3-1.0.1-py2.7.egg\ntlm3\des_dat
a.py", line 25, in <module>
    U32(0x00820200), U32(0x00020000), U32(0x80800000), U32(0x80820200),
  File "C:\python27\lib\site-packages\python_ntlm3-1.0.1-py2.7.egg\ntlm3\U32.py"
, line 32, in __init__
    value = six.byte2int(value)
  File "C:\python27\lib\site-packages\six-1.8.0-py2.7.egg\six.py", line 605, in
byte2int
    return ord(bs[0])
TypeError: 'long' object is not subscriptable

Upvotes: 6

Views: 16812

Answers (4)

Kumar Ankur
Kumar Ankur

Reputation: 31

I had the same issue while connecting to SharePoint using SSO(Single Sign-On) The following statement solved my problem:

pip install requests_ntlm

Upvotes: 3

avantdev
avantdev

Reputation: 2724

I also struggled with this problem when I am on

Python 3.7.0
requests-ntlm==1.1.0

Finally SOLVED with different version

Python 3.7.0
requests-ntlm==0.1.0

Upvotes: 0

Rachel Sanders
Rachel Sanders

Reputation: 5874

Sorry about that! Package maintainer here.

It looks like it was a problem with Windows. I just released v1.0.2 which fixes this and added Appveyor support to catch these problems in future.

Edit: On a Windows PC you probably hit the error with pip HttpNtlmAuth to fix it you will need to pip requests_ntlm to get v1.0.2.

Upvotes: 2

Li-aung Yip
Li-aung Yip

Reputation: 12486

Not an answer, however:

I've opened a GitHub issue for this bug: https://github.com/trustrachel/python-ntlm3/issues/6 .

Currently the workaround is to use requests-ntlm version 0.0.3.

Upvotes: 1

Related Questions