The default HTTP methods in the urllib library are: POST and GET:
def get_method(self):
"""Return a string indicating the HTTP request method."""
default_method = "POST" if self.data is not None else "GET"
return getattr(self, 'method', default_method)
But we can override this get_method () function to get a DELETE request:
req = urllib.request.Request(new_url)
req.get_method = lambda: "DELETE"
source
share