-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send DELETE API Calls via Sharepy #47
Comments
In the current release, the auth headers are sent explicitly for the
This means that, although you should be able to call the delete method, you'll probably get an authentication error. There is a beta release branch for SharePy v2, which uses a Requests authentication class, which should handle all HTTP methods transparently. I'd recommend you give this a try. https://github.com/JonathanHolvey/sharepy/tree/release-2.0.0-beta |
Thanks for the quick reply! So with the beta branch I should be able to use delete() exactly like get() and post() in the previous version? |
Yes, you should be able to. When I originally wrote SharePy, I only ever used the POST method, so I didn't implement authentication for the others. The v2 beta delegates authentication to Requests, so every HTTP method will include the necessary auth headers. I haven't been able to release v2, due to lack of testing. Let me know how you get on and I might be able to finally release it. |
Hm, so I downloaded the zip archive of the 2.0.0 beta and imported it locally, but it I still get the SPException whenever I try to delete something. I tried something like this:
(I also write the answers into files, but for simplicity I did not include this in here) Curiously the post() function does not work either. I tried switching back to the master branch version (1.3.0 I think) and the POST Call worked fine again. Maybe my import is faulty (unpacked the zip of the beta branch and imported that locally)? Le ol' Debugger showed that the beta version directly switches to the requests sessions (which is expected from what I understood of your explanation). |
Can you post the stack trace of the error you're seeing? |
Well the program itself does not really throw any Errors, but the API Call Response contains an SPException:
The "value" field says something along the lines of "The security clearance for the page is invalid and may contain errors." which I always get with DELETE API Calls and also POST Calls if I use the beta version. |
It turns out the digest header was missing for all HTTP methods in SharePy v2, which is the cause of the error you're seeing. I've updated the Thanks for picking this up. |
Hey I wanted to ask if there is a way to send delete API Calls via the sharepy Library as there is no requests equivalent of delete() in your source code.
Grateful for any helping hand.
The text was updated successfully, but these errors were encountered: