pythonrestoffice365apisharepoint-rest-apioffice365-rest-client

Uploading files of different sizes on sharepoint office365 REST Python Client


I want to upload some files to sharepoint via office365 REST Python client.

On documentation on github, I found two examples:

uploaded_file = target_folder.files.create_upload_session(local_path, size_chunk, print_upload_progress).execute_query()

In my case, I want to be able to upload files who are small and also files who are very large. For testing, I wanted to see if the method for larger files works with smaller files too. With a small file, while putting the size_chunk at 1Mb, the uploading was done, but the file uploaded was empty (0b), so I lost my content while uploading.

I wanted to know if there is someone who knows how can we do something more generic for whatever size of files. Also I don't understand what is the size chunk for larger files case. Do you know how one should choose it? Thank you so much!


Solution

  • This problem is solved by installing office365-rest-python-client instead of office365-rest-client.