SecureAuth原因-ShareplumRequestError:Shareplum HTTP发布失败:403客户端



我们正在尝试访问sharepoint,我们是否成功取决于特定的sharepoint部分是否受";SecureAuth";。

如果url没有用";SecureAuth";,但是如果这个URL被"保护";SecureAuth";它返回这个错误。有什么办法解决它吗?

我们正在使用:

from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
authcookie = Office365(sharepoint_address, username=sharepoint_user,
password=sharepoint_user_pw).GetCookies()
site = Site(f"https://myWeb.com/sites/{sharepoint_site}/", version=Version.v365, authcookie=authcookie)
folder = site.Folder(sharepoint_folder) # here come the error

取决于{sharepoint_site}是否工作。

这是相同的错误,但与主题无关

尚不清楚您需要访问的SharePoint是OnPremises还是Online(Office 365(,但我将分享所有可能性和各自的方法:

如果SharePoint网站地址的格式为https://[tenant].SharePoint.com/sites/BusinessAreaOfCompany,其中[tenant][strong>是一个表示引用该公司的字符串。此网站托管在Office 365环境中;相比之下,您共享的上面的代码示例(用户需要最低限度的权限(是这样的:

from shareplum import Site
from shareplum import Office365
authcookie = Office365('https://[tenant].sharepoint.com', username='username@[tenantdomain].com', password='password').GetCookies()
site = Site('https://[tenant].sharepoint.com/sites/BusinessAreaOfCompany', authcookie=authcookie)

否则,如果SharePoint网站url使用与TENANT地址不同的任何公司域,例如https://xyz.company.com/sites/BusinessAreaOfCompany,SharePoint是一个内部部署环境,使用NTLM或Kerberos进行身份验证。适当的代码方法示例是(记住:用户需要最低限度的权限(:

from shareplum import Site
from requests_ntlm import HttpNtlmAuth
cred = HttpNtlmAuth('Username', 'Password')
site = Site('https://xyz.company.com/sites/BusinessAreaOfCompany', auth=cred)

参考:SharePlum:Python+SharePoint

对我来说,这是一个语言问题。我们的sharepoint文件系统是德语的,所以我从改了

"共享文档"到"Freigegebene Dokumente">

在文件夹路径中,一切正常。

最新更新