Sharepoint Authentication With Python
I'm trying to use python to download an excel file that is hosted in a sharepoint which is part of the Microsoft Azure platform. I tried to retrieve the file with HTTPforhumans's r
Solution 1:
Try O365 rest python clientlibrary.it supports SharePoint Online authentication and allows to download/upload a file as demonstrated below: Please find the code here:
ctx_auth = AuthenticationContext(url)
ctx_auth.acquire_token_for_user(username,password)
ctx = ClientContext(url, ctx_auth)
response = File.open_binary(context, "/Shared Documents/User Guide.docx")
with open("./User Guide.docx", "wb") as local_file:
local_file.write(response.content)
You can download the latest version using below command
pip install git+https://github.com/vgrem/Office365-REST-Python-Client.git
For further reference please visit link
hope it helps.
Post a Comment for "Sharepoint Authentication With Python"