'Python MSAL REST Graph: requests.delete does not fully delete file
I am working with the MSAL library to upload to, download and delete files and folders from a OneDrive repo.
To delete a folder I first need to delete all files and folders from it. If I do it in Edge manually, it works fine: I delete all files, then go up the tree and delete the folder.
When I use requests.delete to delete, files disappear from view in the browser, and the delete operation completes successfully, but then trying to delete the containing folder, either programmatically or manually in the browser fails with the Request was cancelled by event received. If attempting to delete a non-empty folder, it's possible that it's on hold error message.
The delete block looks like this:
requestHeaders = {'Authorization': 'Bearer ' + result["access_token"],'Content-Type': 'application/json'}
r = requests.delete(delete_path, headers=requestHeaders)
What am I doing wrong? How to permanently delete a file? Do I need to specify some additional information in either requestHeaders or in another parameter from those listed in https://www.w3schools.com/python/ref_requests_delete.asp ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
