我在python中使用请求库从SharePoint 2010获取页面并且它正常工作,现在我需要遍历SharePoint目录并将所有文件从那里下载到我的本地计算机。理想情况下,我会将其映射为计算机上的驱动器,但此选项不在桌面上。我如何使用python实现这一目标?
def __init__(self, url, domain, username, password):
self.domain = domain
self.username = username
self.password = password
self.url = url
self.session = requests.Session()
self.request = None
self.authentication = HttpNtlmAuth(("%s\\%s" % (self.domain,
self.username)),
self.password)
self.headers = {'accept': 'application/json;odata=verbose'}
self.request_page(self.url)
def request_page(self, url):
relative_url = urljoin(self.url, url)
print(relative_url)
self.request = self.session.get(relative_url,
auth=self.authentication,
headers=self.headers)