我通过Python将文件上传到sharepoint但有错误403

时间:2016-09-23 05:51:22

标签: python session sharepoint request

import requests 
import os 
import sys 
from requests.auth import HTTPBasicAuth 
from requests_ntlm import HttpNtlmAuth


filename = 'test.xlsx' session = requests.Session() session.auth =
HttpNtlmAuth('/user:bentley.com\\EG','EG', session)

file = open(filename, 'rb') bytes = bytearray(file.read()) resp =
requests.put('https://EG.sharepoint.com/sites/EGPlatform/Eg/Testing%20Reports'
 + filename, data=bytes)

 print(resp.status_code)

0 个答案:

没有答案