使用 python office 365 将文件上传到共享点

upload file to sharepoint using python office 365

我正在尝试使用仅限应用程序的凭据将文件上传到共享点,但它在身份验证步骤失败了。不知道这里有什么问题,也验证了应用程序 ID 的权限,但仍然没有运气。

非常感谢任何意见!!

错误信息

TypeError: init() got an unexpected keyword argument 'url'

from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File
site_url = 'https://contoso.sharepoint.com/'
 app_principal = {
     'client_id': '--client-id-goes-here--',
     'client_secret': '--client-secret-goes-here--',
 }
    
 context_auth = AuthenticationContext(url=site_url)
 context_auth.acquire_token_for_app(client_id=app_principal['client_id'], client_secret=app_principal['client_secret'])
    
 ctx = ClientContext(site_url, context_auth)
 web = ctx.web
 ctx.load(web)
 ctx.execute_query()
 print("Web site title: {0}".format(web.properties['Title']))

url应该像下面这样

site_url = 'https://contoso.sharepoint.com/sites/xxx'