5

My goal is to authenticate my client that uses the requests library (2.11.1) in Python 3.5.2 through NTLM with SSPI so that the user does not have to manually enter her domain credentials (used to login to the PC).

I have found the following possibilities, but none work for me:

  • HttpNtlmSspiAuth provokes an exception in requests:

    import requests from requests_ntlm import HttpNtlmAuth, HttpNtlmSspiAuth

    requests.get(site_url, auth=HttpNtlmSspiAuth())




Am I doing something wrong?

Community
  • 1
  • 1
R01k
  • 735
  • 3
  • 12
  • 26
  • 2
    You did not tell us what you *are* doing. "none work for me" is not a question. –  Nov 03 '16 at 17:52

2 Answers2

6

The package requests-negotiate-sspi works for me.

I probably had the same issue with PO, but I was too lazy to try PO's solution and integrate PO's code into mine. And Google helped me out. In case anyone encounters the same exception raised from sspi.py ValueError: year 30828 is out of range, it's a known issue for python 3.6 of requests-negotiate-sspi. See here: Github-Issue

I solved this by creating a new conda environment with python 3.4. Then reinstall some dependencies as well as requests-negotiate-sspi, boom, all works.

unknown
  • 61
  • 1
  • 1
-1

Same issue here but solved when I realized I was in a adm account that doesn’t have authorization to that resource uri.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Reza Heidari Apr 18 '22 at 07:01