import sys
import requests
from bs4 import BeautifulSoup
from shareplum.site import Version
from shareplum import Site, Office365
SHAREPOINT_URL = 'https://***************.com/'
SHAREPOINT_SITE = 'https://***********.com/sites/PowerApp/Lists/changed_class_schedule/AllItems.aspx?skipSignal=true'
SHAREPOINT_LIST = 'changed_class_schedule'
USERNAME = '*****************************'
PASSWORD = '****************'
def authenticate(sp_url, sp_site, user_name, password):
"""
Takes a SharePoint url, site url, username and password to access the SharePoint site.
Returns a SharePoint Site instance if passing the authentication, returns None otherwise.
"""
site = None
try:
authcookie = Office365(SHAREPOINT_URL, username=USERNAME, password=PASSWORD).GetCookies()
site = Site(SHAREPOINT_SITE, version=Version.v365, authcookie=authcookie,verify_ssl=True)
except: s
# We should log the specific type of error occurred.
print('Failed to connect to SP site: {}'.format(sys.exc_info()[1]))
return site
# Test the function
sp_site = authenticate(SHAREPOINT_URL,SHAREPOINT_SITE,USERNAME,PASSWORD)
我正试图使用SharePlum连接到我的共享点列表,但我无法调试此";无法连接到SP站点:列表索引超出范围";有人能帮我吗?很抱歉,由于的安全原因,我不得不在代码中使用***
SharePoint网站url应如下所示:
SHAREPOINT_SITE='https://***********.com
或
SHAREPOINT_SITE='https://***********网站/PowerApp/