I am working on a report automation project, where I need to download excel files automatically from a share point location. I tried some examples referring to Python - Download files from SharePoint site but getting below error within imported library function. Please let me know, what I am missing here.
Error:
Traceback (most recent call last):
File "worklod_report.py", line 66, in
if ctxAuth.acquire_token_for_user(username='murali.pandiyan@xyz.com', password=pwd):
File "C:\Users\murali.pandiyan\AppData\Local\Programs\Python\Python37-32\lib\site- packages\office365\runtime\auth\authentication_context.py", line 18, in acquire_token_for_user return self.provider.acquire_token()
File "C:\Users\murali.pandiyan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\office365\runtime\auth\saml_token_provider.py", line 57, in acquire_token
self.acquire_service_token(options)
File "C:\Users\murali.pandiyan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\office365\runtime\auth\saml_token_provider.py", line 88, in acquire_service_token
token = self.process_service_token_response(response)
File "C:\Users\murali.pandiyan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\office365\runtime\auth\saml_token_provider.py", line 119, in process_service_token_response
return token.text
AttributeError: 'NoneType' object has no attribute 'text'
Python code:
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
import getpass
if __name__ == '__main__':
ctxAuth = AuthenticationContext(url='https://internal.abc.net/sites/Compute/')
print("Enter Password:")
pwd=getpass.getpass()
if ctxAuth.acquire_token_for_user(username='murali.pandiyan@xyz.com', password=pwd):
ctx = ClientContext(settings['url'], ctxAuth)
print("Authentication is success")
else:
print(ctxAuth.get_last_error())