Downloading sharepoint lists using python

tanjil
New Contributor III

Hello,

I am trying to download lists from SharePoint into a pandas dataframe. However I cannot get any information successfully. I have attempted many solution mentioned in stackoverflow. Below is one of those attempts:

# https://pypi.org/project/sharepoint/
 
 
from sharepoint import SharePointSite, basic_auth_opener
  
server_url = "https://teamup.<company_name>.com/"
site_url = server_url + "sites/pt/service/metrics/sitedata/"
opener = basic_auth_opener(server_url, username, password)
site = SharePointSite(site_url, opener)

When the following code is executed I am getting an error:

for sp_list in site.lists:
    print(sp_list.id, sp_list.meta['Title'])

Error generated:

<urlopen error [Errno -2] Name or service not known>

Any help on this issue is greatly appreciated.

Thanks in advance,

Tanjil