从Python调用Sharepoint 2013 API [英] Calling Sharepoint 2013 API from Python

查看:157
本文介绍了从Python调用Sharepoint 2013 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾在PnPSharepoint上玩过游戏,该网站在您的网站上效果很好.它使用 Windows Credential Manager进行身份验证,我可以使用这些方法来获取文件夹内容.

但是,我已经尝试通过Python与共享点进行通信时遇到了一个阻止程序.我对身份验证很感兴趣.

这就是我要做的.

从我的Python(可以是任何其他脚本语言)连接到共享点,共享方式与PnPSharepoint相同,可以在其中设置Windows凭据管理器.然后获取文件夹名称.

有什么想法吗?


解决方案

您可以在下面查看由George共享的步骤.

http ://tech.bool.se/using-python-to-request-data-from-sharepoint-via-rest/

常规步骤:

为SharePoint启用基本身份验证.

通过具有身份验证的REST api访问SharePoint.

最好的问候,


I had a play with the PnPSharepoint which works nicely from your website. It uses Windows Credential Manager to autheticate and i can use the methods to get folder contents.

However, i have reached a blocker for trying to talk to sharepoint via Python. I am stuff at authentication.

This is all i want to do.

Connect from my Python (can be any other scripting language) to sharepoint same way as PnPSharepoint where i can setup windows credential manager. Then get folder name.

Any idea?


解决方案

Hi,

You could check the steps shared by George below.

http://tech.bool.se/using-python-to-request-data-from-sharepoint-via-rest/

General steps:

Enable Basic Authentication for SharePoint.

Access SharePoint by REST api with authentication.

import requests
from requests.auth import HTTPBasicAuth
 
headers = {'accept': 'application/json;odata=verbose'}
r = requests.get("http://example/_api/web", auth=HTTPBasicAuth('someUser', 'somePassword'), headers=headers)
 
print r.json()["d"]["CustomMasterUrl"]

Best Regards,

Lee


这篇关于从Python调用Sharepoint 2013 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆