小编tiv*_*voo的帖子

使用 Python 从 SharePoint 加载文件

所以我尝试使用以下代码加载位于Python(子)目录中的文件:

import json

from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.runtime.client_request import ClientRequest
from office365.runtime.utilities.request_options import RequestOptions

ctx_auth = AuthenticationContext(url)
if ctx_auth.acquire_token_for_user(username, password):
  request = ClientRequest(ctx_auth)
  options = RequestOptions("{0}/_api/web/".format(url))
  options.set_header('Accept', 'application/json')
  options.set_header('Content-Type', 'application/json')
  data = request.execute_request_direct(options)
  s = json.loads(data.content)
  web_title = s['Title']
  print("Web title: " + web_title)
else:
  print(ctx_auth.get_last_error())
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

无法从https://login.microsoftonline.com/extSTS.srf获取二进制安全令牌 从 https:/DOMAIN.website/siteDocuments/Document/example/ 检索身份验证 cookie 时发生错误

现在,Microsoft 链接显示端点仅接受 POST 请求。收到 GET 请求。

有什么解决方法吗?谢谢。

python authentication rest sharepoint

5
推荐指数
1
解决办法
1万
查看次数

需要帮助从R中的日期中删除时间模式

我想摆脱日期列中的时间戳。

在R中使用gsub。似乎无法弄清楚要使用哪种模式。

"2019-04-03T20:31:47Z"
Run Code Online (Sandbox Code Playgroud)

希望能有所帮助。到目前为止,这没有用:

gsub("T[:digit:]$", "", week0_album$created)
Run Code Online (Sandbox Code Playgroud)

r gsub

0
推荐指数
1
解决办法
54
查看次数

标签 统计

authentication ×1

gsub ×1

python ×1

r ×1

rest ×1

sharepoint ×1