What Is the Python Requests Syntax Equivalent of a curl “-X DELETE”?

Problem scenario
You are invoking requests.get() in a Python program (after an "import requests" statement near the top of your code).  You want to pass the equivalent of "-X DELETE" in curl in your Python program.  How do you use the DELETE option with a REST API call in Python?


This assumes you have "requests" installed (e.g., sudo pip install requests).  If you need assistance installing pip, see this link for Debian/Ubuntu, this link for a Linux SUSE server, and this link for CentOS/RHEL/Fedora.

Use requests.delete() in your code.  This external page http://docs.python-requests.org/en/master/user/quickstart/ used to have more information.

Leave a comment

Your email address will not be published. Required fields are marked *