Home >>Python Requests Module >Python Requests delete() Method
Python Requests delete() Method sends a requests to DELETE the specified resources (file, record etc.).
Syntax:requests.delete(url, args)
Parameter | Description |
---|---|
url | It is Required. The request of the url |
params | It is Optional. A dictionary, to send as a query string. Default value is None |
allow_redirects | It is Optional. To redirection of a Boolean(Default value is True) |
auth | It is Optional. to enable a certain HTTP authentication of a tuple. Default value is None |
cert | It is Optional. It specifying a cert file or key of a string or a tuple. Default value is None |
cookies | It is Optional. To send to the specified url of a directionary of cookies. Default value is None |
headers | It is Optional. to send to the specified url of a dictionary of HTTP headers. Default value is None |
proxies | It is Optional. The proxy url of the protocol. Default value is None |
stream | It is Optional and indicates a Boolean. Default False |
timeout | It is Optional. A tuple or a number, indicating how many seconds to wait for the client to make a connection |
verify | It is Optional. A string or a Boolean indication to verify the servers TLS certificate or not. Default value is True |
import requests
y = requests.delete('https://phptpoint.com/python/demopage.php')
print(y.text)
import requests
url = 'https://phptpoint.com/python/demopage.php'
z = requests.delete(url, allow_redirects=False)
print(z.text)
<head><title>Document Moved</title></head> <body> <h1>Object Moved</h1> This document may be found <a HREF="https://www.phptpoint.com/python/demopoage.php">here</a> </body>
import requests
url = 'https://phptpoint.com/python/demopage.php'
n = requests.delete(url, auth = ('user', 'pass'))
print(n.status_code)
import requests
url = 'https://w3schools.com/python/demopage.htm'
x = requests.delete(url, cert='folder/myclient.cert')
print(x.status_code)
import requests
url = 'https://w3schools.com/python/demopage2.php'
x = requests.delete(url, cookies = {"favcolor": "Red"})
print(x.status_code)