Skip to content

Requests MissingSchema Error when downloading file #271

Description

@etiennecelery

Hi!

I'm having trouble downloading a file from SharePoint using the latest 2.2.1 version of Office365. When I try to download a file a "MissingSchema" Error from the requests module appears. I don't know what happened, if I go back to version 2.1.5 the code runs fine. Thank you very much and I appreciate the hard work in this module; super useful!

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)

Error:
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?

Using MacOS,
Office365 2.2.1,
Python 3.8.3,
requests 2.2.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions