【发布时间】:2022-07-07 05:21:44
【问题描述】:
我正在尝试向 SharePoint Online 进行身份验证。使用 sharepy v 2.0、pyCharm 社区版和 python 3.9。
当我跑步时:
'sharepy.connect('siteurl')'
在 PyCharm 中,当我在运行对话框中输入我的用户名后,Sharepy 将冻结。
如果我添加“用户名”参数并运行它。什么都没发生。从来没有提示我输入密码
如果我使用控制台并输入 sharepy.connect('siteurl') 然后是用户名和密码(传递这些参数也是如此)我会收到错误:
Traceback (most recent call last):
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\sharepy\auth\adfs.py", line 75, in _get_token
token = root.find('.//wsse:BinarySecurityToken', ns).text
AttributeError: 'NoneType' object has no attribute 'text'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\sharepy\session.py", line 15, in connect
return SharePointSession(site, auth=autoauth)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\sharepy\session.py", line 61, in __init__
self.auth.login(self.site)
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\sharepy\auth\adfs.py", line 27, in login
self._get_token()
File "C:\Users\Andrew\AppData\Local\Programs\Python\Python39\lib\site-packages\sharepy\auth\adfs.py", line 77, in _get_token
raise errors.AuthError('Token request failed. Invalid server response')
sharepy.errors.AuthError: Token request failed. Invalid server response
应该注意我从 godaddy 获得 O365 并且登录页面是联合的?我认为是正确的术语。
根据 Sharepy 的新版本,这无关紧要。
有没有其他人遇到过这种冻结问题? 鉴于我目前的情况,我将如何使用 sharepy 对 sharepoint 进行身份验证?
【问题讨论】:
-
同样的问题:
s = sharepy.connect(SPUrl, username, password)即使我通过了用户名和密码。 -
@BenceKaulics 我找到了我的问题的根源以及解决方案后另一个问题的根源。我很快就会回答我自己的问题。
标签: python sharepoint pycharm sharepoint-online sharepoint-rest-api