我想将文件上传到我的共享点库,但我收到错误403,这个返回codecs.charmap_encode(输入,self.errors,encoding_map)[0] UnicodeEncodeError:' charmap'编解码器不能编码字符' \ u2019'位置27227:字符映射到 任何人都可以帮助我
import requests
from requests.auth import HTTPBasicAuth
from requests_ntlm import HttpNtlmAuth
session = requests.Session()
session.auth = HttpNtlmAuth('/user:example.com\\bingo','bingo', session)
sessionObj = requests.session()
url1='http://login.microsoftonline.com'
r = sessionObj.post(url1, params={'username':'bingo' , 'password':'bingo'})
print (r.status_code )
filename = 'test.xlsx'
file = open(filename, 'rb')
bytes = bytearray(file.read())
resp = requests.put('https://example.sharepoint.com/…/e…/Testing%20Reports/Forms/' + filename, data=bytes, auth=session.auth)
#url2='https://bentley.sharepoint.com/…/Testin…/Forms/AllItems.aspx'
#r = sessionObj.post(url2, data={},files = {'upload':file})
print (r.text)