Кроме того, поскольку это может быть актуально: я Я работаю в блокноте Jupyter.
Мой код сейчас выглядит так:
Код: Выделить всё
import io
import pandas as pd
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.files.file import File
url = 'https://COMPANY.sharepoint.com/:x:/s/COMPANYNAME/XXXXXXXXXXXXXXXXXXXXXXXX'
username = "USER"
password = "PASSWORD"
ctx_auth = AuthenticationContext(url)
if ctx_auth.acquire_token_for_user(username, password):
ctx = ClientContext(url, ctx_auth)
web = ctx.web
ctx.load(web)
ctx.execute_query()
response = File.open_binary(ctx, url)
bytes_file_obj = io.BytesIO()
bytes_file_obj.write(response.content)
bytes_file_obj.seek(0) #set file object to start
df = pd.read_excel(bytes_file_obj, sheetname = None)
Код: Выделить всё
ValueError: Cannot get binary security token for from https://login.microsoftonline.com/extSTS.srfКод: Выделить всё
ctx.execute_query()Я немного не знаю, что попробовать, я прочитал пару статей, но ни одна из них не оказала существенной помощи, поэтому любые советы от здесь был бы очень признателен!
Подробнее здесь: https://stackoverflow.com/questions/772 ... sharepoint