I have a script that checks a SharePoint list for a specific file revision and returns the result. This works well, but currently my authorisation method requires me to incl
There is an open pull request for the requests_ntlm library here to merge in SSPI authentication for Windows users. I had to make a few edits to the code for it to be functional, but it is working for me.
You'll first need to install requests and requests_ntlm, then modify the "requests_ntlm\__init__.py" package file (in your Python "Lib\site-packages" folder if on Windows) to resemble the following:
from .requests_ntlm import HttpNtlmAuth
from .requests_ntlmsspi import HttpNtlmSspiAuth
__all__ = ('HttpNtlmAuth', 'HttpNtlmSspiAuth')
Next, add the "requests_ntlmsspi.py" file (from the link above) to the "requests_ntlm" package folder.
You should then be able to authenticate using the current user's credentials as follows:
import requests
from requests_ntlm import HttpNtlmAuth, HttpNtlmSspiAuth
requests.get(site_url, auth=HttpNtlmSspiAuth())