μλ νμΈμ!
μ΅μ 2.2.1 λ²μ μ Office365λ₯Ό μ¬μ©νμ¬ SharePointμμ νμΌμ λ€μ΄λ‘λνλ λ° λ¬Έμ κ° μμ΅λλ€. νμΌμ λ€μ΄λ‘λνλ €κ³ νλ©΄ μμ² λͺ¨λμμ "MissingSchema" μ€λ₯κ° λνλ©λλ€. λ²μ 2.1.5λ‘ λμκ°λ©΄ μ½λκ° μ λλ‘ μ€νλ©λλ€. λλ¨ν κ°μ¬νλ©° μ΄ λͺ¨λμ λ Έκ³ μ κ°μ¬λ립λλ€. λ§€μ° μ μ©ν©λλ€!
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.file import File
def auth(username, password):
ctx_auth = AuthenticationContext(url)
if ctx_auth.acquire_token_for_user(username, password):
ctx = ClientContext(url, ctx_auth)
return ctx
ctx = auth(username, password)
response = File.open_binary(ctx, relative_url)
μ€λ₯:
MissingSchema: Invalid URL "<bound method ClientContext.service_root_url of <office365.sharepoint.client_context.ClientContext object at 0x7fb4e44c3d90>>web/getfilebyserverrelativeurl('MYRELATIVEURL')/\\$value": No schema supplied. Perhaps you meant http://<bound method ClientContext.service_root_url of <office365.sharepoint.client_context.ClientContext object at 0x7fb4e44c3d90>>web/getfilebyserverrelativeurl('MYRELATIVEURL')/\$value?
MacOSλ₯Ό μ¬μ©νμ¬,
μ€νΌμ€365 2.2.1,
νμ΄μ¬ 3.8.3,
μμ² 2.2.4
2.2.1 λ²μ μλ gitμ μ΅μ λ²μ μ μ¬μ©νκ±°λ μ€μΉ μ μλμΌλ‘ μμ ν΄μΌ νλ λ²κ·Έκ° μμ΅λλ€. https://github.com/vgrem/Office365-REST-Python-Client/blob/master/office365/sharepoint /files/file.py#L275
λ²μ μμ ctx.service_root_url
λ μμ±μ΄μ§λ§ ctx.service_root_url()
λ©μλμ¬μΌ ν©λλ€.
@efremovd μ @etiennecelery κ° κ·Έκ²μ μ‘μλ΄κ³ μ νν μ§μ ν΄μ£Όμ
μ κ°μ¬ν©λλ€. μ€μ λ‘ μ΄κ²μ λ²κ·Έμ΄λ©° service_root_url
μμ±μ λ©μλλ‘ λ¦¬ν©ν λ§νκΈ° λλ¬Έμ 2.2.1
λ²μ μμ λ°μν©λλ€.
μΈκΈνλ―μ΄ GitHubμμ μ¬μ©ν μ μλ _latest_ λ²μ μ μ΄ λ¬Έμ λ₯Ό ν΄κ²°ν©λλ€.
pip install git+https://github.com/vgrem/Office365-REST-Python-Client.git
λλ μλμ κ°μ΄ νμΌμ λ€μ΄λ‘λν μ μμ΅λλ€.
file_url = '{server-relative-path-to-download}'
with open(download_path, "wb") as local_file:
file = ctx.web.get_file_by_server_relative_url(file_url).download(local_file).execute_query()
κ°μ¬ν©λλ€!! νλ₯ν μΌ
μ΄νμ μ΄κ²μ λ«λ κ²μ΄ ν΄κ²°λμμΌλ©° 2.2.2
λ²μ μ΄ μΆμλμμ΅λλ€.
κ°μ₯ μ μ©ν λκΈ
2.2.1 λ²μ μλ gitμ μ΅μ λ²μ μ μ¬μ©νκ±°λ μ€μΉ μ μλμΌλ‘ μμ ν΄μΌ νλ λ²κ·Έκ° μμ΅λλ€. https://github.com/vgrem/Office365-REST-Python-Client/blob/master/office365/sharepoint /files/file.py#L275
λ²μ μμ
ctx.service_root_url
λ μμ±μ΄μ§λ§ctx.service_root_url()
λ©μλμ¬μΌ ν©λλ€.