Office365-REST-Python-Client icon indicating copy to clipboard operation
Office365-REST-Python-Client copied to clipboard

400 error when downloading files with special characters in the name

Open tomwagstaff-opml opened this issue 1 year ago • 0 comments

Low priority request since I have a workaround.

If I try to download a file using the File.open_binary method like this:

with open("my_local_filepath", "wb") as output_file:
    response = File.open_binary(client_context, file_url)
    output_file.write(response.content)

and the file has a special character in the name (in my case a ') the download fails with a 400 error: HTTPError: 400 Client Error: Bad Request for url... Wrapping the url with urllib.parse.quote doesn't help.

Not sure if this approach is deprecated anyway since I can't find it in the examples. When I do use the new download method it works fine.

tomwagstaff-opml avatar Jun 26 '24 16:06 tomwagstaff-opml