0
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) 

I am trying to connect to my sharepoint list using SharePlum but i cant debug this "Failed to connect to SP site: list index out of range" Can anyone help me? Sorry if i have to use *** in my code because of security

1 Answers1

1

The SharePoint site url should be as follows:

SHAREPOINT_SITE = 'https://***********.com

OR

SHAREPOINT_SITE = 'https://***********.com/sites/PowerApp/

Gaurav T
  • 257
  • 1
  • 6