I saw this: Python - Download files from SharePoint site
But it does not work for me. I am getting the following error:
assertion_node = dom.getElementsByTagNameNS("urn:oasis:names:tc:SAML:1.0:assertion", 'Assertion')[0].toxml()
IndexError: list index out of range
Here is the code I am using, what am I doing wrong?
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File
url = """https://my_url.sharepoint.com/location/AllItems.aspx?otherstuff"""
username = "here_is_my_username"
password = "here_is_my_pw"
ctx_auth = AuthenticationContext(url)
ctx_auth.acquire_token_for_user(username, password) <---this is where it errors out at
ctx = ClientContext(url,ctx_auth)
Edit #1:
The clue is somewhere in here:
'saml': '{urn:oasis:names:tc:SAML:1.0:assertion}',
That line isn't populated for some reason....the question is, how do I populate it and with what? It comes from the saml_token_provider.py file when you install these libraries:
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File