У меня есть следующий код, который, по моему мнению, будет работать для большинства сайтов sharepoint, но я получаю следующую ошибку:
Исключение («Проверка имени пользователя / пароля и корневого сайта»)
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
url = 'https://company.sharepoint.com'
username = 'user123@company.com'
password = 'password'
listname = 'Test List'
ctx_auth = AuthenticationContext(url)
if ctx_auth.acquire_token_for_user(username, password):
ctx = ClientContext(url, ctx_auth)
web = ctx.web
sp_list = ctx.web.lists.get_by_title(listname)
items = sp_list.get_items()
ctx.load(items)
ctx.execute_query()
else:
print(ctx_auth.get_last_error())
Как бы я манипулировал этим кодом, чтобы обеспечить возможность извлечения данных из списка SharePoint в Python?