【问题标题】:How to get a file from Sharepoint with a url如何使用 URL 从 Sharepoint 获取文件
【发布时间】:2015-12-30 13:32:21
【问题描述】:

我想从位于 Sharepoint 文件夹中的 URL 获取文件(xlsx)。

url = 'http://www.sharepointexampleurl.com'
username='username'
password='password'         
response = requests.get(url, auth=(username, password), headers={'Connection': 'close'})
if response.status_code >= 300:
    raise osv.except_osv(_('Error'), _('Bad Request'))

我总是收到 403 错误。 我必须使用共享点库吗?我可以在没有身份验证的情况下从 URL 获取文件,但通过身份验证我不能。有什么想法吗?

【问题讨论】:

标签: python url sharepoint request


【解决方案1】:
site = "http://www.sharepointexampleurl.com"
username = "username"
password = "password"
response = requests.get(site, auth=HttpNtlmAuth(username, password))
print(response.status_code)

【讨论】:

  • 请解释什么是HttpNtlmAuth 以及为什么会这样。
猜你喜欢
  • 2022-10-07
  • 2014-01-17
  • 2021-01-08
  • 1970-01-01
  • 2021-02-18
  • 1970-01-01
  • 1970-01-01
  • 2022-08-21
  • 2020-04-03
相关资源
最近更新 更多